Automate Win 95 with old-fashioned batch files

Q In Windows 95, batch files have been supplanted by Shortcuts and the Startup folder. Now I must load three programs to use my Iomega Zip drive. Iomega's installation program places these files in the Startup folder, which is fine if you use the drive all the time, but I don't. How do I make a batch file in Windows 95 that can run all three programs with one click?

û Robert De Filippi

Easy ù you create an old-fashioned, DOS-style batch file. Not only do such files work in Windows 95, they work better, and they can handle some new tricks.

For instance, you can run a Windows program from within a batch file, something you couldn't do in Win 3.x. And you can control whether the programs run simultaneously or sequentially.

A batch file is the same in Win 95 as it is in Win 3.x and DOS. It's a script in the form of a text file, containing anything you might type at the DOS prompt, and each command must be on its own line.

You can create a batch file in Notepad. When you save it, select the type All Files (*.*) and give your file the extension .bat.

To edit a batch file, right-click the file's name in Explorer and select Edit. This will bring up the file in Notepad.

By default, batch files expect Windows programs to multitask, so they don't wait for one to close before launching the next. If you want a program to run its course before the next one starts, add the command start /w (for "wait"). The batch file illustrated won't process the defrag command until the scan is finished.

 


Batch files are still handy in Win 95. This batch file tells your system to scan the hard drive, then defrag it

 

To close a batch file's window when the program has finished, end it with the command cls (for "close screen"). That command must be the only item on the last line, without even a return after it.

A Shortcut to a batch file is a wasted cluster, which could take up as much as 32K. Instead, put the batch file on the desktop or in C:\Windows\Start Menu. You'll lose some cosmetic control ù you won't be able to change the icon ù but you'll know where the real batch file is.

û Lincoln Spector


Category: Win95
Issue: May 1998

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