Using Windows Batch Files to Overcome Procrastination

Using Windows Batch Files to Overcome Procrastination

SUMMARY: I have a lot of projects that require multiple apps, folders, and documents to be open. I’m trying something with batch files to make it easier to switch between projects quickly.

My productive work happens primarily at a computer screen, working with a myriad of documents and applications. It takes a while to set up all those app windows and documents, and once they are up I am not happy about moving them. It’s also a pain in the butt to dig into my document folders to find the right files.

For example, if I’m making an update to my website, I might have a good number of the following open:

  • GMail
  • An SSH terminal window, or two
  • A browser with the system error log, plesk website admin panel, and possibly the ISP control panel
  • Analytics pages
  • WordPress admin page, and WordPress posts page
  • Dreamweaver, Photoshop, Bridge
  • Digital camera files directory
  • Windows Explorer windows for images, public download directories, and related project
  • Browser windows for reference links and supporting information

That is, by my reckoning, about 30-40 clicks of the mouse to get up and positioned on my screen. If I’m doing some work on a client project, I’ll have:

  • Basecamp in three browser windows (messages, dashboard, writeboard)
  • Project Files: Word documents, dev journal, issue tracker, InDesign or Illustrator
  • Photoshop, Dreamweaver
  • Subversion folders
  • Various browser windows for looking up stuff.
  • At least one Windows Explorer file window open, probably two
  • Gmail / Calendar
  • Skype
  • Excel for timetracking

It takes dozens of clicks to close old windows and open new ones. I find this incredibly annoying. I’ve tried multiple desktops and leaving windows open all the time. However, this just makes it so I have to chase which window is where. Plus, I like to close documents and save them as new revisions periodically; leaving things open is just asking for trouble.

Batching It Up

I finally got tired of this last week and made a batch file that opened all this stuff for me. I figure this might have two benefits:

  • It’s easier to drive right into a project, because the batch file opens up all the relevant files for me to see without little effort.

  • It’s easier to close everything related to one project (saving first) knowing that I can open it up easily later.


p>A batch file is simply a text file that has the extension .bat (for batch). If you don’t see the extensions on your files, it’s probably because Windows hides them from you by default, figuring that the carnal knowledge that there are such things as FILE TYPES would make your eyes bleed. To show the naughty file extensions, you can check out these instructions.

Windows still has this primordial command line interface (or CLI, as we old-timers like to say) built-in. If you open your Windows Start menu at the bottom-left of the screen and type cmd into the Search Programs and Files box, a CLI window will pop up. The batch file (below) are the commands that you could type into the CLI; the idea of the batch file is that it does the typing for you.

Here’s an example batch file (right-click to download):

REM Simple Batch File to start programs and documents
REM For 64-bit and 32-bit versions of Windows XP or greater

@echo off
set ProgRoot32=%ProgramFiles%
set ProgRoot64=%ProgramFiles%
if not "%ProgramFiles(x86)%" == "" set ProgRoot32=%ProgramFiles(x86)%

REM Start an File Explorer that stays inside the specified folder.
REM Remove the /ROOT parameter (leave the comma) to disable folder lock.
%SystemRoot%explorer.exe /ROOT, D:pathtodirectory

REM Start a 32-bit application. Replace with %ProgRoot64% if running 64-bit app.
start "Dreamweaver" "%ProgRoot32%AdobeAdobe Dreamweaver CS5.5Dreamweaver.exe"

REM Open a couple webpages
start "WPAdmin" ""
start "Wikipedia" ""

REM Open a document (simulates a double-click)
start "My Document" "D:pathtodocument.doc"

REM for other variables you can use in paths

To use it yourself, you’ll have to rename it to .BAT instead of .BAT.TXT. Also, you’ll need to substitute your own programs and directory paths.

Anyway, this batch file does one of three types of actions:

  1. A “file explorer” window with a specified directory already open.
  2. A specific program (32-bit or otherwise)
  3. A specific document or webpage, as if I’d double-clicked it

So when I want to open up all the files related to one project, I double-click the batch file and everything opens at once. When I’m done, I close all the windows and quit all the apps. I have several batch files set up to do the following common activities:

  • Open specific client’s set of folders and project management docs / web pages.
  • Open my invoicing files
  • Open my “New Blog Post” apps (Photoshop, Dreamweaver), related image directories, and WordPress admin pages.
  • Open my “Maintain” apps, folders, and so on.

The biggest pain in the butt in setting up the files is finding the “full path” to the programs and documents you want. If it’s a program, you can right-click the program’s name in the start menu, and choose Properties to view either the Shortcut or File Location. If it’s a document, you can actually drag the icon into the cmd windows, and Windows will fill it in for you. Yes, this is all very tedious; if someone knows of a utility that handles this all for you (or ideally sets up something similar so I don’t have to edit batch files), let me know.