2

I have a scheduled task that is supposed to run a batch file. The batch files runs file when called on it's own, but does not run when wrapped in a scheduled task.

Here is what the dialog looks like:

enter image description here

2

In my case the solution was to replace the mapped drive with the fully qualified path. So instead of:

XCOPY C:\DATA Z:\ (where Z is the drive mapped to \\SERVER\DATA$)

I changed to:

XCOPY C:\DATA \\SERVER\DATA$

I run the task as Administrator and it worked like a charm.

0

If you are trying to copy these folders to a network share, it will not work because the scheduled task is run as 'System'. If this is the case, you have to specify which user the task is Run As.

Source

  • @mmcglynn in the general tab, check out the user/group it is run under there. Enable the history on the item, and the history on the whole thing also , you will see more usefull errors. For me it was some stupid thing with the batch I forget what, but one of the batches wouldnt run hidden, I assume as security?? You will get it, but it can be a pain. Also running right after a boot can fail , a delay could solve that. – Psycogeek May 18 '12 at 1:09
0

I managed to get around this by using a combination of the Robocopy utility (for its more robust logging and error handling) and the NET USE command.

NET USE B: \\remote-machine\location RemotePassword /user:remote-machine\RemoteUserName

robocopy.exe B:\ D:\backups /NP /LOG+:D:\robocopy\robocopy.log /R:10 /W:5

This script maps the remote location to the network drive B: using the specified username and password for the remote machine.

Robocopy then copies the contents of the folder on the network location to the D:\backups folder. This will also log details to the specified robocopy log file so you can see how many files have been copied etc.

0

It guess. But high possible. Execution of .bat or .cmd really imply execution of cmd.exe In Windows for some (I think security) reasons, cmd.exe os executable only for interactive user. So it only can be executed when user logged in locally.

Give some group right to execute cmd.exe as sheduled task and assign user from whom executing this task to this group.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.