Sunday, November 22, 2015

MS-DOS Batch Files

After my experience with BASIC on the TI-99/4A in Jr. High, I lost touch with the advances in personal computers for my high school years. That helps to explain why I didn’t consider computer science when considering possible careers. If I hadn’t gone into ministry I would have likely done something in math or science, but somehow programming just wasn’t on my radar at that time.

It was a college roommate that got me back in touch with computers. He was from Switzerland and he had a laptop, something which wasn’t extremely common in 1990. This laptop ran MS-DOS and, to make it a little more user friendly, he had created an AUTOEXEC.BAT batch file that served as a menu for selecting and launching programs.

So while it would be a stretch to call it programming, I learned how to write batch files from my roommate. Batch files are just a sequence of commands, stored in plain text, to be interpreted by the command line interpreter. This was a very useful thing for a PC running DOS, like the Intel 386 computer I later got while still in college. But even after I upgraded to the impressive Windows 3.1, I still used the command prompt and batch files to accomplish some common tasks.

I even used batch files at my job, on Windows XP, a decade later to make daily backup copies of the Access database we were doing heavy daily work on. Of course we could get backup files restored by the IT department, but that would take the greater portion of a day and  by then hours of productivity could be lost. So I wrote a batch file that I ran each morning that made local backup copies of the database from the last two days. It would delete copy 2 (from two days ago), rename copy 1 (from the day before) as copy 2 and then make a fresh copy 1 from the current version. So if something went wrong, we could instantly get back to the copy from that morning or the morning before.

When I see a need, I've always enjoyed finding a time saving solution, either from something I've used before or, these days, Googling something new. Today I might come up with a better solution, but at that time a batch file met the need with little effort and it was fun to use something that brought back memories of an earlier time in my journey.

i++

No comments:

Post a Comment