Search code examples
sql-serversql-server-agent

SQL Server Job - The system cannot find the file specified


I am running a SQL Server Agent job which zips up my database backups. The application I run is a C# Windows Application which takes in the path of the database as an argument. When I run the application form a command prompt all works well. However when I run it from within a sql server job using the Operating System (CmdExec) as the type I get the following error.

“The system cannot find the file specified”

Within the job I have the following as the command:

D:\DatabaseBackups\DatabaseBackupManager.exe D:\DatabaseBackups\SubDit\Database.bak

I have tried setting specific directory permissions for the SQL Server Agent account on the DatabaseBackups folder but still get the same error.

Can anybody throw any light onto this one as Google did not throw up anything that worked and is starting to drive me a crazy.

Thanks


Solution

  • Thanks for your help guys. I tried everything you suggested and found out that it was looking in the C:\Windows\System32 folder for the 7za.exe that I was using to zip up my backups. I had referenced the exe as if it was being called from the same directory that my application was running in.

    Thanks again