DOS Question

Come in! Have a margarita or root beer? How about some fresh trout? :)

Moderator: Moderators

Post Reply
User avatar
XMEN Iceman
Moderator
Posts: 2386
Joined: Thu Nov 18, 1999 1:25 pm

DOS Question

Post 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:
User avatar
Spinning Hat
Inmate
Posts: 2564
Joined: Wed Jun 07, 2000 10:06 am
Location: Minneapolis, MN
Contact:

Post by Spinning Hat »

You need to take a shower... DOS sucks!
Image
"Never, Never, Never quit." - Winston Churchill
"Men don't like to cuddle. They only cuddle if it leads to.. You know.. Lower cuddling." - Ray Romano
"Tell your wife that she looks pretty, even if she looks like a dump truck." - Ricky, age 10
User avatar
XMEN Gambit
Site Admin
Posts: 4122
Joined: Thu Nov 18, 1999 12:00 am

Post 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.
Image
Post Reply