SQL Server Agent Adding a Parameter for a CmdExec

buzzzzjay picture buzzzzjay · Nov 17, 2011 · Viewed 10.9k times · Source

I want to add a parameter to a step that runs an operating system (CmdExec) in SQL Server Agent. I have searched everywhere and asked my coworkers and none of them had tried it before. I have attached a picture of the screen. I was thinking that I might be able to add the parameter (file path) after the .exe statement, but wasn't sure.

I thought the following might work:

Executable Path              Parameter Path
C:\MyProgram\MyApp.exe       E:\AppInfo\Client\Config.txt

This is on a production server and I didn't want to break anything if this isn't correct.

Thanks!

Picture of Job Step

Answer

Filip Popović picture Filip Popović · Nov 17, 2011

Yes You can use parameters, so your command would be:

C:\MyProgram\MyApp.exe E:\AppInfo\Client\Config.txt

If there is a space in the name don't forget to use quotes as specified in tip in screenshot:

"C:\My Program\MyApp.exe" "E:\App Info\Client\Config.txt"

Since You want to try it on production server, consider testing your configuration and software on test environment first. If You doubt that this will work, You can set job to execute only this single step to make sure it will work as expected.