Hi, I am using a bat file on a Windows 2000 SP4 server to copy database files while the database is shut down. Once the bat file hits the xcopy command, it does the copy, but never returns to the bat file to continue with the other commands (start up the database, etc). I should mention that the xcopy takes several hours. Is there some sort of time out or time max with bat files? Is this normal? If so, is there any way around this?
There's no timeout that I'm aware of on .bat or .cmd files. However, there may be on the process that's launching it? How are you launching it?
Batch files don't timeout. It sounds like you might be running into a prompt from XCOPY, like an "Are you sure" prompt.
Make sure you've added the necessary command-line switches to XCOPY to make it silent.
The ones I'm aware of are:
-Y to suppress prompts about overwriting files
-C continue even if errors occur
Also, make sure that you are running the XCOPY.EXE app, and not finding an XCOPY.BAT file somewhere on your path. (calling a batch file from a batch file prevent returning, unless you use the CALL command)
And, be sure you are not overwriting the batch file itself during the XCOPY.
thanks for getting back to me. I had no idea what was going on.
Here's my command: xcopy /O /Y E:\xxx\yyy*.* E:\aaa\bbb\data 1>> E:\aaa\bbb\log\backup.log
I am launching the backup .bat file from the windows scheduler. All files were copied so I don't think I hit an error (/C switch). So maybe my problem is that I am not running xcopy.exe. I will specify the full location.
Presumably everything looks OK in your backup.log file? It looks like you are redirecting STDOUT to your log file, but not STDERR - would suggest adding 2>&1 to the end of the command line to ensure you're not missing any error information from the log.