I have a SQL 2008 Agent job with a single Operating system (CmdExec) step:
C:\Scripts\Script.cmd
Script.cmd runs a CS-Script.
If I run C:\Scripts\Script.cmd, everything appears fine - I get my expected logging output and echo %ERRORLEVEL% shows 0 afterwards.
When I run it through SqlAgent, though - I get my expected logging output and then
The system cannot find the file specified.
Process Exit Code 1.
The step failed.
The logging output is complete and correct, so it does run the batch file and the EXE that the batch file calls. The last thing the CS-Script does is:
Console.WriteLine("Exiting at 2009-09-22 16:10:32 with Status {0}", exitCode);
return (int)exitCode;
which is logged in the output, and in entirety.
What file can't it find?