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" "http://davidseah.com/"
start "Wikipedia" "http://wikipedia.com"

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

REM See http://en.wikipedia.org/wiki/Environment_variable#System_path_variables
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 davidseah.com” 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.

8 Comments

  1. Patrick 8 years ago

    You should look into virtual desktops in windows, a la Linux.

    http://virtuawin.sourceforge.net/

    This way, you can have multiple sessions without stepping on the other ones.

    Love your blog/site/work, btw!

  2. Author
    Dave Seah 8 years ago

    Patrick: Thanks! I did look at using multiple desktops, and they’re a good idea in theory, but the issue is that most apps I use stick to one desktop. I can move them around, but now I am spending time remembering which virtual desktop has which app. And the “stickies” app I use to keep track of? Instead of being on my desktop all the time, now I have to hunt for it.

    I think virtual desktops work for a single project focus with multiple deep-focus steps (development, for example), but not so much with less-structured project work flows. I could be approaching it all wrong, though…perhaps the Zen of the Virtual Desktop eludes me, and I’m missing some critical insight about their use. I’ll have to think about it. An “integrated creative environment” that could save the day, but current tools (with the exception of development and programming environments) are not at that stage. Makes sense…programmers, with the ability to create their own software, have created the ability to easily shift between project workspaces and access every tool they need from inside one environment. Everyone else, though, is screwed :)

  3. Peter Knight 8 years ago

    I recently got an updated PC and have been using virtual desktops again, I think a faster pc makes a difference to make the virtual desktops more feasible. I do recognize the issue of having to find apps, so I’m just using 3 desktops, one of which is for non-work stuff and the other two are all the apps for 2 projects. It also let’s you specify what programs you want to have visible on all desktops.

    I think the net benefit of the virtual desktops for me is that I can keep all the project related documents open without it distracting me while I work on other stuff. I like being able to toggle between stuff quickly. Having to get all programs setup is a pain, having a batch file to set it all up is clever. I think the best of both worlds has to be something that can save and reload a desktop state…something like that should already exist…hmm

    I also switched to a solid state hard drive and boy that makes a difference in loading times, incredible. Only downside is the small disk size.

    • Author
      Dave Seah 8 years ago

      I never really had issues with the speed. Currently I have an 8-core i7-2600K conservatively overclocked to just under 5GHz, but even when I was running the old 2007-era PC it wasn’t a problem.

      I’ve been thinking of getting an SSD too, copying the Windows and Programs directories to it, and then using hard links to graft it into the C:\ drive. Theoretically it should give me boot and app loading speed while not sacrificing data storage overall. I think Windows 7 or some new chipset has direct support for this…I can’t remember though.

      Which virtual desktop extension are you using, btw?

      Freezing/reloading a desktop state is a cool idea. I have a few virtual machines kicking around on my computer. I found you can install one copy Windows 7 into a Virtual PC instance, for example, without conflict with the main license, and you can freeze-refreeze at will. However, copy/paste operations are a little unreliable between the VM and host computer.

  4. Peter Knight 8 years ago

    8-core? I didn’t know they had 8 core, that must be some beast of a machine. I actually got the ssd mostly because it doesn’t make a ton of noise like a normal hard drive, but the speed has been such boost. I have most of my files on an external drive but program files and windows run from the ssd drive.

    I used to use windowspager which is very minimalistic but now I’m using mdesktop (http://code.google.com/p/mdesktop/). It has keyboard shortcuts, dual monitor support and it has the ability to make certain programs visible on all desktops which is handy for the monitor brightness app I use.

    I did some googling for programs that could remember a desktop/workspace state and I could only find some very rudimentary programs. I noticed other people were using Virtual PC as well, I might try that since I could also load up different browsers for browser testing stuff.

  5. Author
    Dave Seah 8 years ago

    The i7-2600K is actually a quad-core, I just realized, but hyperthreaded (2 threads per core). They do sell 8-core machines and up through; Apple has a 12-core machine, for example (UPDATE: this is a dual 6-core CPU architecture, not 12 cores on-chip). I spent a lot less though building my own machine from pieces that I like. It might be a little-bit overkill; it’s main advantage to me is that with 8 threads of processing, the machine rarely gets sluggish on slow scripts or background processes. The effect is subtle; on my 2007-era MacBook Pro 17 (a duo-core 2.4GHz processor) running 32-bit Windows 7, I am constantly dealing with small hiccups in the mouse or starting apps. They aren’t very long hiccups and I don’t notice them unless I’ve been using the desktop for a while or if I’m recording audio (digital dropout are more likely). It’s just a bit smoother, and there’s less waiting. In driving terms, I feel just a little better connected to the road.

    I’ll check out Windowspager. I just tried something called Dexpot, which I read about on Lifehacker, on my laptop. It integrated nicely but I immediately ran in the issue of never having the right window on the right page, or the switching keys not working because some app was using them. I use keyboard shortcuts extensively, and there are never enough free keys. Makes me want to look into those USB footswitches again, so I can use my feet for switching between desktops.

    • Demetrio 8 years ago

      Well, actually there are 24 virtual cores in the last MacPros (optional)… (6+6 real, 12+12 virtual).

      Anyway, back to the point: even if opening and closing applications and windows is a great time saver, I find more useful to go back exactly in the same place, in the same configuration. And this is difficult to achieve with just batches.

      It’s like to have many (real) desktops where you can put all your books, papers, accessories, then change desktop or room, and go back to the previous project with the help of many memory aids (a book open on a certain page, a pen or a post-it put on a precise place, and so on).

      I greatly rely on visual and spatial memory to recall the point I was when I leaved or switched a project for another one. This really make me save hours.

      That’s why from years I work on Apple PowerBooks/MacBook Pros (with MacOS), that I reboot maybe 8-10 times a year, just stopping/hybernate them, leaving all my windows of each project always open, to easily retrieve the exact point I stopped.

      I have to thank you for many great ideas I made mine:

      1 – Ergotron LCD monitor arms

      Absolutely fantastic! Finally the freedom to clutter my desktop with something else than monitors and CPUs :-). I buyed two, for an initial dual MacBook Pros configuration with one external monitor. My productivity increased a lot, having two CPUs and three monitors, I could place different tasks (mail, calendar, graphics, development) in different places, always at hand.

      Not happy with this, I continued to use Spaces (Mac OSX Leopard) to switch projects on the main MBP. I went up to 6 spaces for projects, with a “sidebar” dedicated to mailing, browsing, scheduling. I could manage up to 6 projects without losing any information and “placement” of them. So I could immerse in each project without losing time and without trying to recall anything. With just a key combination to switch from one to another, with the freedom to multitask or concentrate on a single task. Great!

      Still not happy, I built a FileMaker application to have a “dashboard” of ongoing projects that resembles the Spaces disposition, so with just a look at it (on my iPad, another screen aside the others… :-) ) I know exactly where to jump when I need to switch to that project.

      Now with Mac OS X Lion you can just close an application and reopen it with each window in the same position as it was when closed. Even reopen all applications where they were, after booting the Mac. And having the documents auto-saved with versions. Quite similar to the effect you were looking for, I think. A brilliant application, as a native OS function. And gives me the feeling that it “just works”.

      Oh, at last I decided to further improve my monitors equipment, with a great 27-inches Apple LED display. Maybe 5-times more expensive than the previous 22-inches monitor I had (an ASUS), but 100-times better and more productive. Just 2 of its many advantages: no color issues, absolutely exact-matching from the MacBook Pro monitor and the printed results (I’m a graphic designer, too); a lot of space (I call it the “football field”!) to arrange windows side by side without switching if not between projects: having an A4 vertical page, with Word instructions, and post-it notes all aligned on the same monitor (and something else on a side monitor) is priceless…

      2 – The other (but chronologically the first) great idea I took from you is the Emergent Task Planner, that I used (a bit personalized) from years to track my time.

      I just love it, love to write with pens and pencils, take notes, draw on it my thoughts when they appear. I just needed a way to do something automatically, without having to re-write things to track all time required by each project with many tasks. My last evolution of it is a little application I developed, that launches an AppleScript (similar to a batch command, speaking in Windows) to put the bits of time I REALLY worked on something, on iCal as 30-minutes meetings, specifying client, project, notes. So I can track my time and productivity, bill it, have an history of each progress I make on a project, all with the minimum effort. I use 30-minutes slices, instead of 15-minutes, because I find it the minimum trackable time (to me). And using a pomodoro-like timer I can also keep focus and take a 5-minutes rest (eye and body stretching, everything) every 25-minutes work, and 20-minutes rest (a power nap, for instance) every 4 “pomodoros”. The next evolution will be to take all these time slices from iCal to my projects database, to have a precise history, and a visual representation of time spent on each project (similar to your Emergent Task Timer).

      I felt very distracted, before adopting this group of techniques/tools, due to the continuous need to switch from a project to another (open this, close that… move to a client’s site, go back and recall everything…). But for everything, I think that one has to find his own balance and personal style of organization, the one that gives the best results. Like you, I have followed many roads, many tools and techniques (yours, GTD, Now Habit…), still searching for a perfect one, but found the 80/20 compromise that let me use a lot of time in a productive way, having also an automatic track of the work done.

      I just wanted to share with you my experience, and to thank you very much for all the inspiration you gave me. Thanks!

      P.S.: Sorry for my poor English… i’m not an English native speaker.

  6. Les Becker 8 years ago

    BRILLIANT! I’ve missed DOS options – never occurred to me that I could still write .bat files. I think I’ve lost much of my brain since Windows came to be….