Why is my batch file failing or how can I figure out why?
I have a batch file that copies files from a development machine to a production machine. When I run the bat file manually while logged in as an administrator, the files are copied successfully. However, when I execute the bat file through scheduled tasks, even though the job runs and completes, no files are copied. The job is scheduled to run under an administator account, has administrator permissons for the job, and the mapping is using the same administrator permissions.
This is the bat file:
start /wait net use K: \\AU-WEBDEV-VM\pyrlman09 /persistent:yes /Y
mcopy K:\*.* e:\inetpub\wwwroot\pyrlman09 /S/e/Y/v/c/d/i
When I open K, there are files.
When I log the results of the scheduled task, I get the following in the log file:
C:\WINDOWS\system32>start /wait net use K: \\AU-WEBDEV-VM\pyrlman09 /persistent:yes /Y
E:\inetpub\wwwroot\pyrlman09>xcopy K:\*.* e:\inetpub\wwwroot\pyrlman09 /S/e/Y/v/c/d/i
0 File(s) copied
But when I run the bat file manually the desired file gets copied. Please advise as this has been a bane for at least a couple of years. Any other suggestions are appreciated.