Search code examples
sql-serverbatch-file

Running a batch file from SQL Server Agent Job


I have the following file placed directly in the C drive on my SQL server:

File

The job is configured as below

Job[2]

But when i run the job it just loops and loops. If I run the file manually it works perfectly. What am I doing wrong?

enter image description here


Solution

  • I had the same issue. I did resolve it by using below command and giving permissions to the .bat file for this user NT Service\SQLSERVERAGENT

    cmd.exe /c E:\tools\test.bat

    enter image description here