Ken Baker Consulting

PC Network Engineering And Support


Technical Information

Below are articles and howto's that I've written for customers
or myself that are an aid (or reminder) on how to do certain tasks.

Here's a little something for those who are enamored of batch files.

Batch files (remember your old DOS days?) were originally designed to enable us to run a series of DOS commands to perform a task. Windows 95 came along and the functionality of batch files as we knew them pretty much went away because (1) they were generally used for file management and (2) file management is now done with Windows Explorer or something similar. It's not that batch files no longer work - they do - but long filenames and paths can make things a bit unwieldy.

What I'm presenting here is a method to easily launch multiple applications by running a single batch file. Sounds like pretty standard stuff, but there's a twist that you might not be expecting. I'm not launching the applications, but their associated documents.

Note for those wondering what applications I'm talking about:  The info presented here should give you an idea of what can be done with batch files in the Windows graphical environment.  The Palm Desktop and MS Streets and Trips are very old and no longer used - at least by me.  Just look at this as a method rather than a set of strict procedures.  For the record, I now use Google Maps, my Google Apps Calendar, and Excel; all launched manually.

I track my mileage and travel expenses using an Excel spreadsheet. I calculate the miles using a template in MS Streets & Trips. My schedule resides in the Palm Desktop. All of these items have shortcuts. The Excel sheet has a shortcut to the sheet, the Streets shortcut points to a template, and the Palm shortcut points to PALM.EXE. There are two things to consider here; all these items are shortcuts with the .LNK extension and .LNK files are executable.

As you've surmised, I created a batch file that launches the shortcuts. Works great and is a good click saver. There are some caveats to keep in mind if you try this.

  • Because we are usually dealing with long paths and long filenames, the commandline must be enclosed with double quotes.
  • Because it's a batch file, there is a max commandline length of 127 characters, so be careful here.
  • Because we are dealing with a file system that understands mixed case, it's a good idea to match the case of your commandline to what you're using (case-wise) in your file system. You can easily copy & paste much of your commandlines from Windows Explorer using the address bar. I have not tested incorrect case to see if I can break the batch file, but the possibility exists because the double quotes allow us to specify mixed case and long filenames in a character mode environment.

Here's a copy of the mileage tracking batch file I described above:

=================================================

@echo off
"C:\Documents and Settings\Ken\Desktop\Palm Desktop.lnk"
"C:\Documents and Settings\Ken\Desktop\Documents\Streets.lnk"
"C:\Documents and Settings\Ken\Desktop\Documents\Current Mileage.lnk"
exit

=================================================

You can drop the batch file pretty much anywhere on the local system (your machine - not a network drive) where you have full access. Then create a shortcut to this batch file and have the shortcut run it minimized and close on exit.

This launches all three tools that I use to calculate and track my mileage. All I do is cool-key (Alt-Tab) from one to another as needed.

Pretty simple stuff, and handy as well. Create your own little beastie in any text editor and give it a go.


KBC
Home

Who is this
Ken guy?!

Services
Offered

Ken's
Links

Contact
Information