I'm new to windows batch scripting, but I was able to get something working that I needed. It works when executing it manually, but when Task Manager executes the script, it doesn't complete. The Last Run Result is "(0xff)."
The script is simple:
@echo off
for /f %%i in ('VerifyWarehouseLoad.exe') do set RESULT=%%i
IF %RESULT%==1 (
start /wait /d "C:\Program Files\Sisense\Prism" psm ecube build name="Test" serverAddress="LocalHost" mode="restart"
)
@end
It runs fine with just the line beginning start /wait
.
I executes a console app named VerifyWarehouseLoad (located in the same directory as the batch file, captures the output and if the value is 1 it runs the line in the IF block.
I'm reading that the (0xff) is a syntax error, but that doesn't seem right if it's processing fine outside of Task Scheduler…
Thanks for any help.
Best Answer
This would work, if the file would be javascript file (.js). Since you are using batch file, you should use
exit /B n
to quit batch file, where 'n' is exit code. (Source)