I'm attempting to run a (Windows) batch file from within a SQL Server agent job under SQL Server 2008 R2. In the Job Steps, I've created a new step, set its type to "Operating system (CmdExec)". I initially tried to put just the batch file name in the "Command" field. It gives an error that it can't find the file.
Then I tried: cmd.exe c:\test.bat
This starts, but never completes (and it doesn't look like it's actually working anyway).
I tried wrapping the batch file name in quotes: cmd.exe "C:\test.bat" but that also doesn't make any difference.
What is the magical combination to get this to work?
Best Answer
If memory serves me correctly:
Quotes are needed if there are any spaces in the path or file name