SQL Job step for calling batch file

  • Hello,

    I'm trying to add a step to an already existing SQL Server Agent job on Server A. What I want this step to do is call a batch file on Server B and execute it on Server B.. I've been told by the DBA to use the Operating System Command option for the step and to use either UNC, NET USE, or the PUSHD/POPD commands in attempting to call the batch file.

    Now, I am not too familiar with how to go about doing this so I would appreciate any help with the syntax for using one of the above methods..

    Server A name: BO-SQL-A01

    Server B name and share folder: \\BO-SQL-A04\share\batch.bat

    I am using the same username/password on both servers.

    eg username: user1

    eg password: pwd1

    Please help this newbie. 🙂

    Thanks,

    Jim

  • I've attemted to add a step in the SQL job using a Transact-SQL script (T-SQL) type with the command being

    EXEC master..xp_CMDShell 'D:\share\batch.bat'

    note: the path of 'D:\share\batch.bat' is on the Server B where the batch file is located. I ran the job but it still didn't execute the batch file on the Server B from Server A. Any ideas or suggestions.

    Thanks,

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

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