Run batch files on shutdown



Q I'd like to run a batch file that copies my files to a server when I am shutting down my Windows 95 machine. Is there some way to get Windows to do this automatically?
- Pauline Hodel

AThere are several programs around that allow a more customisable shutdown in Windows 95. After looking at a couple, the one I found most effective was a shareware program called ShutDown v1.64 (available on our cover CD or from http://members.fullnet.net/cdb/). ShutDown allows you to specify a program or batch file in the command line.
Many readers would have come to computers after the dreaded DOS days, and may never have heard of batch files. These are DOS shell scripts and are identifiable by a .BAT extension. In a batch file you can use any command that you could type at the DOS prompt, which includes launching both DOS and Windows programs.
For example, to copy files from your hard drive to a network drive you can use the command xcopy. This is a highly versatile version of the old DOS copy command.
To backup up all files in a directory before shutdown you might create a batch file called bu.bat which includes the following line:
xcopy c:\work\*.* n:\backup /s /y /d
The /s switch copies subdirectories, /y will replace files without asking the user for confirmation, and /d copies only files newer than those in the destination directory.
Alternatively you could use a program such as the DOS version of PKZip (available from http://www.pkware.com) to zip up files to the network drive, allowing you to save space.


ShutDown for Windows 95 and NT lets you exit the OS from a batch file or Shortcut


You could also consider using a backup program such as the one built into Windows 95. You can create a backup set and save it to a file. For example, I created a backup set called work.set that backs up my entire c:\work directory to a network drive.
To simplify the shutdown and backup procedure you can create a Shortcut to the ShutDown program on your desktop. Right-click the new Shortcut, choose Properties and select the Shortcut tab. In the Target field, add the parameters for your batch file.
- Roy Chambers

Category: Win95
Issue: Apr 1998

These Web pages are produced by Australian PC World © 1997 IDG Communications