How do I run a batch file from a scheduled Job via SQL Server Agent 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?
If memory serves me correctly:

cmd.exe /c "c:\test.bat"


Quotes are needed if there are any spaces in the path or file name