Bat File runs fine manually, but not as a scheduled task
I'm running 2008 server r2.
I'm trying to use an extremely simple bat file to backup a small directory to a NAS device.
The bat file is:
batbackup.bat
robocopy d:\docume~1\ x:\batbackup\documents /e
robocopy d:\pictures\ x:\batbackup\pictures /e
robocopy d:\ezfile~1\ x:\batbackup\ezfile~1 /e
I have this scheduled as a task, and to run as admin. I get no errors in scheuler, and it actually says it ran on time. But nothing has been copied over since the last time I manually ran this. If I run the bat file from the command line, it runs absolutly
fine.
When I look in the history, within 1 second the following ids are created:
event id task category Operational code
100 task started 1
200 action started 1
129 created tastk process info
201 action completed 2
102 task completed 2
In the main window, the "last run result" is (0x10)
Thoughts?
March 29th, 2012 2:08pm
is x a mapped network drive?
I am gonna guess that it is and your problem is that it is running in your user context, but not with your profile loaded so X doesnt exist try using the full network path
Free Windows Admin Tool Kit Click here and download it now
March 29th, 2012 2:38pm
Hi,
As you run the task as admin, whether that specific account has permission to run the BAT file, access/copy files from d:\<folder name> or copy files to x:\backup folder? Please have a look on this.
TechNet Subscriber Support in forum |If you have any feedback on our support, please contact tnmff@microsoft.com.
March 30th, 2012 5:17am
0x10=ERROR_BAD_ENVIRONMENT
Don't use mapped drive, use full path instead.
If the error still occurs, please refer to post below and try other suggestions:
http://social.technet.microsoft.com/Forums/en-ZA/w7itprogeneral/thread/fdb09326-46c3-4536-842d-ac15bf886076
Or try
Anyways it was a permission related problem, simply solved it by going into Properties for the batch file, going into compatability and checking the tick box for "Allow non-administrators to run this program" and changed my user on the task back to what
it was, now it works perfectly, not sure what the problem was but still it's solved. Can't believe it was something so simple."
"
from http://www.avforums.com/forums/computer-software-operating-systems/1001996-scheduled-task-error-0x10.html
Free Windows Admin Tool Kit Click here and download it now
March 30th, 2012 5:26am
0x10=ERROR_BAD_ENVIRONMENT
Don't use mapped drive, use full path instead.
If the error still occurs, please refer to post below and try other suggestions:
http://social.technet.microsoft.com/Forums/en-ZA/w7itprogeneral/thread/fdb09326-46c3-4536-842d-ac15bf886076
Or try
Anyways it was a permission related problem, simply solved it by going into Properties for the batch file, going into compatability and checking the tick box for "Allow non-administrators to run this program" and changed my user on the task back to what
it was, now it works perfectly, not sure what the problem was but still it's solved. Can't believe it was something so simple."
"
from http://www.avforums.com/forums/computer-software-operating-systems/1001996-scheduled-task-error-0x10.html
March 30th, 2012 12:17pm