I am trying to run a batch file from a SQL Agent job. This batch file is a connection command and script file that will run. I can run the the actions straight from Command Prompt, but I need it to be fired from a SQL Agent job for the automation of it.

Every time I try to fire it off I get these errors:

"The system cannot find the file specified"

When I set the command up, I am using the GUI in the Jobs area and using the 'Open' button and then navigating to the proper file. I have also tried changing the Services from the NT user to a Local Admin user, but still had the same end result.


The 'Open' button is for the convenience of importing a large script into the command window, which is not helpful with this type of job step as I explain below. If you want it to run a batch file, you simply enter the path and filename, such as:




And be sure to specify the type of command as "Operating System (CmdExec)"

Whatever account the step is set to run as will need permission to execute the batch file or process as well as access to any resources that are used in the script or process.

Also, a quirk of this type of job step is that it will only run one command. So if you put the following in the command input box:

rem This script does something

It will run the first command and then stop, so the batch file will not be run. So that is why the 'Open' button is not really helpful for CmdExec job steps.

| improve this answer | |
  • Thank you so much for the input and clarification. This helps a lot. – mikey10104 Feb 19 at 21:27
  • As for the permissions: use proxy. – dean Feb 20 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.