>IF NOT EXIST %Main_PATH%File_Extract\Status\File_Extract_Main%JobNbr%_OK.txt ( > REM powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-EventLog -LogName 'VACCN' -Source 'DataRepo' -EventID 5120 -EntryType Error -Message 'Fatal error in VA Extract process.'" > REM call %Main_PATH%EventWriterWriter\Scripts\release\EventWriter.exe %JobNbr% "DR_101" "batchfile" "Fatal error in VA Extract process." > EXIT 11 >) >ELSE ( > REM powershell -NoProfile -ExecutionPolicy Bypass -Command "Write-EventLog -LogName 'VACCN' -Source 'DataRepo' -EventID 5100 -EntryType Information -Message 'Successful completion of Extract Job 89.'" > REM echo “Successful completion” > EXIT >)>
IF .... ( ... ) ELSE ( ... )part of the help information if I type "if /?" on the command line in CMD.EXE
... The ELSE clause must occur on the same line as the command after the IF. For example: IF EXIST filename. ( del filename. ) ELSE ( echo filename. missing. ) The following would NOT work because the del command needs to be terminated by a newline: IF EXIST filename. del filename. ELSE echo filename. missing Nor would the following work, since the ELSE command must be on the same line as the end of the IF command: IF EXIST filename. del filename. ELSE echo filename. missing The following would work if you want it all on one line: IF EXIST filename. (del filename.) ELSE echo filename. missing ...