Sql-server – .bat file works manually, but does nothing in SQL Server Agent job

sql serversql-server-2012sql-server-agent

I am able to run a .bat file that copies an .exe file into a specific folder, and runs it to extract some files manually.

When I use it as part of a SQL Server Agent job (step 1), I get success for the job called "Daily_Update", but it doesn't actually do anything.

The server that the SQL Server is on is different from where the file location where the files are moved and executed. I am specifying the file location with the UNC Path. \\A10 is the server with the scripts and .dat files that I am manipulating, \\A08 is the one with the SQL Server.

With the disk designator c:\ notation, I get:

The system cannot find the path specified.

When I use the UNC path name, I get:

Access is denied.

When I run the .bat file from the desktop of the server where the SQL Server lives, it works fine manually.

Any ideas why this might be happening?

Best Answer

The SQL Server user account has access to that specific folder?
Try running a simple xp_cmdshell to check that.

EXEC master.dbo.xp_cmdshell 'dir C:\<path>'