Thursday, 7 April 2016

Remembering… Batch Files

Remembering… Batch Files

Back to a time when scripting was king

Windows is a great operating system for modern users. Within reason, it’ll provide everything you’ll ever need in terms of your work and administering the system, all from its fancy-looking graphical user interface.

Sadly, though, there’s rarely a need these days to drop back to the command prompt and tap away at the keyboard like someone possessed. Obviously you can opt to enter CMD into the Windows Run menu, and use it to reveal your IP address, ping another computer or even rename several file types to another type, but it’s nothing compared to the old DOS and Windows 3.11 days, when the command prompt still ruled supreme.

The major thing I miss about the command prompt is the batch file. I think I had a batch file for nearly every possible situation that my computer would ever come across. Need networking? Not a problem: there was a batch file to activate the NIC. Need to back up the entire C-drive? Yup, had that sorted.

The most recognised batch file was of course Autoexec.bat, that quirky startup script file that allowed you to load DOSKEY and your mouse driver into high memory areas. But you could modify that to include a menu system that would, depending on the user’s choice, load a certain device or start with more conventional memory allocated to be able to run a game, for example.

Its History

Batch files were around from as early as 1981, back when IBM released its DOS 1.0 for these new-fangled personal computers.

However, there were only a few commands available and supported by dir, copy, erase, pause, rem, rename, date, time and type. That didn’t offer a huge amount of scope for the early PC user, but it could still process .BAT files, and that made it quite a flexible platform. Incidentally, I think the batch file editor of the time was EDLIN, but I’m sure there are some of you old enough to correct me.

Batch files really got to spread their wings when later versions of MS-DOS started to appear, especially with DOS 4.0 and its new multitasking features.

As time moved on, more devices and hardware were becoming the norm for the PC. This of course meant that the user had even more control over what was loaded and how. And with the availability of better commands to use within DOS, the user could make choices as to where in the available memory a device could be loaded.

Gradually, the batch file became more and more obsolete. Windows XP saw the last of the batch file being generated through the creation of DOS disks. Naturally, you can still create a batch file, even with Windows 10, but it’s severely limited in its use due to the limitations of what’s available via the command prompt.

These days, the batch file has seen something of a revival through PowerShell scripting. Although it’s not a batch file in the old sense, it’s still a command line based script, so we’ll let it off.

The Good

Batch file weren’t just for admin duties; you could create games with them. Loading various hardware into strange memory locations. Creating elaborate menus to end up launching something that would have been quicker from just the command prompt.

The Bad

When someone gave you a batch file that you didn’t check, and it contained something like format c: /Q /y /AUTOTEST.

Did You Know?
• Fork Bombs, enough said.
• Using a double colon instead of REM resulted in a quicker batch file execution.
• Use command /y /c (name of the batch file) to step through it line by line.
• Run all your batch files in a RAM drive for increased speed.