start "Backing up database" /min %comspec% /c xcopy /R /Z /Y c:\rxsche~1\pharma~1.mdb w:\backups
Two things here. First: Your original may work fine with just a a /Y flag on the xcopy line, or the /R /Z /Y.
That window is not closing because the copy is not done. It is still waiting for an answer to confirm overwrite of the backup database. If the task was not told to be interactive, it has no connection to the console from which to get the answer. /Y tells it not to ask, /R tells it to overwrite even if read only, and /Z is restartable mode (designed for network drives)
Making the window go away is nothing more than making sure it does finish. Making it stay (for troubleshooting) requires extra work unless it's hung up waiting for something. A pause after the xcopy would show when that is done, or not seeing the "press any..." from pause would show the xcopy is not finishing. Again, you would have to make the script interactive to be able to answer the pause, of course, or take it out when all is well.
Second is minor: By using start to put this task in a minimized window, the task window dissappears almost faster than it can draw. The real work can be watched if you're quick enough, by clicking "Backing up database" in the taskbar. If you want to see the window stay alive after done, you can use this:
start "Backing up database" /min %comspec% /k xcopy /R /Z /Y c:\rxsche~1\pharma~1.mdb w:\backups
and switch back to "/c" when you're confident it is working correctly.
Enjoy,
2K
(\o/)
Main Topics
Browse All Topics





by: spiderfixPosted on 2003-08-26 at 16:02:18ID: 9228397
@echo off
copy c:\autoexec.bat c:\download
@cls