Article ID: 121170
Article Last Modified on 9/30/2003
IF "%VARIABLE%" == "" GOTO MODULEThis example checks for the existence of the environment variable "VARIABLE." If VARIABLE does not exist, the statement is true and control of the batch file jumps to the MODULE section. If the statement is not true, that is, the VARIABLE variable does exist, program control skips to the next line of the batch file and continues.
IF "%PATH%" == "" GOTO NOPATH :YESPATH @ECHO The PATH environment variable was detected. PATH=C:\DOS;%PATH% GOTO END :NOPATH @ECHO The PATH environment variable was NOT detected. PATH=C:\DOS; GOTO END :ENDThis example tests for the existence of the PATH variable. If it exists, control passes to the YESPATH section; otherwise, control is passed to the NOPATH section.
Additional query words: 6.00 6.20
Keywords: KB121170