Schedules Task to run Batch file

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a batch file which I routinely run to copy some large files to my PC
from a server (with the XCOPY command). The batch file also contains a
following DIR command so that I can see that the files have been copied over
(with the latest dates), and at the end is a PAUSE statement so that the
command prompt window stays open while I review the file dates. It all works
very well

I also created a scheduled task to execute the batch file (just a one-off
execution while still testing). When I run the task, nothing happens for a
few seconds, and then a command prompt screen flashes up and disappears
within a couple of milliseconds (too fast to get a screen dump), and the
files haven't been copied.

Any ideas as to why the batch file may not be executing properly?
 
Vilem Sova said:
I have a batch file which I routinely run to copy some large files to my PC
from a server (with the XCOPY command). The batch file also contains a
following DIR command so that I can see that the files have been copied over
(with the latest dates), and at the end is a PAUSE statement so that the
command prompt window stays open while I review the file dates. It all works
very well

I also created a scheduled task to execute the batch file (just a one-off
execution while still testing). When I run the task, nothing happens for a
few seconds, and then a command prompt screen flashes up and disappears
within a couple of milliseconds (too fast to get a screen dump), and the
files haven't been copied.

I believe you need to use the Windows GUI, e.g. Control Panel, Scheduled
Tasks, to edit the Scheduled Task and enter in an ID and password that is
valid on that remote system. By default, scheduled tasks run as a local
system account that cannot authenticate to other systems on the network.

Do note that someone else accessing your machine might be able to modify
your batch file or your scheduled task to get your password or your
permissions. You may or may not care about that.

I'm fairly sure that's the problem, but if you continue to have problems,
you can temporarily add a "pause" statement to the end of the batch file and
an @echo on statement to the beginning of the batch file to try to see what
error message if any is occuring.
 
Karl pointed you in the right direction. I just wanted to add that it
sometimes helps to go to Control Panel/Scheduled Tasks and then go to
advanced - view log which may have helpful information. Also check the
security logs on both computers involved to see if any failed logons or
failed privilege use events [if enabled in Local Security Policy] to see if
anything helpful can be found there. --- Steve
 
Back
Top