Page 1 of 1

DOS Question

Posted: Tue Oct 23, 2007 9:24 am
by XMEN Iceman
I am migrating a very simple scheduled copy batch file from one server to another.

The copy batch file runs fine if you just click and run it manually. But when I schedule it using Windows Task Scheduler in Server 2003 it says it is running...but you cannot see what it is doing and nothing is copied over.

I have no idea as to why it does not work under the scheduler.

Ideas? Thoughts? Rude Comments? :lol:

Posted: Tue Oct 23, 2007 1:15 pm
by Spinning Hat
You need to take a shower... DOS sucks!

Posted: Tue Oct 23, 2007 6:14 pm
by XMEN Gambit
First, does the batch file wait for input from the user? If so, it'll never get it! That would also explain the apparent hangup. Even if a command doesn't normally need input. For example, a copy might ask you if you're sure you want to overwrite an existing file, and then you're stuck. Most commands have a "silent" or "force" switch so you can power through that sort of thing.

Second, if you want to debug, you can send each command's output to a log file and check that. To do so, put one or two "greater than" signs at the end of a line of the batch file, followed by the log file name. E.g:

Code: Select all

copy c:\file1.* d:\target\* >> logfile.log
If you use one "arrow," each run of the batch will wipe the previous log. Two arrows will leave the previous run's entries. Use the "echo" command to write your own message, and then send that to the log, too.