Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why this returns ELSE is not recognized command
Message
 
 
To
All
General information
Forum:
Windows
Category:
DOS commands
Title:
Why this returns ELSE is not recognized command
Miscellaneous
Thread ID:
01678538
Message ID:
01678538
Views:
49
Hi everybody,

I'm trying to figure out why I am getting this error from SQL Server Agent job which is supposed to execute a batch file.

End of the batch file is this:
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
)
The error in Agent is the following (end of the step):

'ELSE' is not recognized as an internal or external command, operable program or batch file. Process Exit Code 9009. The step failed.

Do you see what may be wrong with the bat file - it seems OK to me.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform