SQL agent using CmdExec

  • Hi,

    I'm trying to build a process using SQL agent, and CmdExec to call a batch file. However whenever it runs, I get an error saying the process cannot be created, reason: the parameter is incorrect.

    Ive created a credential and proxy, and this was working last week, which means I've obviously altered something, but I can't work out what.

    I've stripped the process back to basics.
    The job step runs as my proxy, with a command of "c:\test.bat"
    The batch file is simply now
      @echo off
      echo test

    But istill get the error.

    As a last resort, I changed the agent service to run as a local admin and then set the job step to run as the agent service account - same error.

    I've deleted and recreated the login, credential, proxy and job.

    I'm obviously doing something fundamentally wrong, but the error refers to parameter being incorrect but I'm not passing any parameters - although the batch file name is a parameter to the application which will run it. I've therefore checked that batch still have a file association and that they run.

    At this stage any help will be greatly appreciated

  • if anyone else encounters the same problem (or more likely when I get the same problem again in the future), the solution was that i didn't have the path to the batch file on the first line of the command window on the job step screen.
    I'd entered a carriage return on the first line and was typing on the 2nd line.

    as soon as the command was moved to the first line it all started working again.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply