Batch Files Gurus?

Soldato
Joined
28 Sep 2008
Posts
14,207
Location
Britain
What are realistic commands. I'm doing a VSS backup scheduled with a batch file (called backup.bat).

I start it with stuff like

Code:
ECHO OFF
CLS
"my command"

Other things I want to do are make the command window remain open and then close once the backup is complete. If the window shuts early, the backup will fail.

Hoping you can help

TIA
 
What are you looking to do within the batch file? The batch file won't terminate until it has finished all the commands (or errored!).
 
Will it terminate itself or do you have to put "exit" in at the end?

The batch file will be run as a scheduled task. As Windows Server 2008 cannot do scheduled backups to a network drive.
 
The batch file should close out when it has finished all of the commands (for example you could use a goto to a label of :EXIT with no commands under it to exit from the batch file).
 
The batch file should close out when it has finished all of the commands (for example you could use a goto to a label of :EXIT with no commands under it to exit from the batch file).

Ok, I need to explain it a bit more I think.

My batch file is like this:

Code:
ECHO OFF
CLS
WBADMIN START BACKUP -backupTarget:"\\server\Backup" -include:C:,D: -vssFull -quiet

Whilst the window is open it give you regular updates as to it's status, for instance:

Code:
Running backup of volume local disk C:. copied 86%

It will run till it reaches 100% then just says, command completed sucessfully. But, the CMD windows stays open
 
whilst you say you can't backup to a network drive, can't you just map the \\server\backup to b: and then use whatever you want to backup to b:
 
Had a similar problem myself before, I *think* I worked around it by calling a VBScript from within the batch file, the VBScript then called the command instead of the batch file.

If you don't get a solution before Monday I can check what my script does :)
 
Back
Top Bottom