Windows

I have what I believe to be a rather unique combination of tweaks to make Windows as efficient as possible. I credit when I can, but some of these tweaks I read about years ago and have long since forgotten where…

Start Menu

I use a simple little script, along with the junction.exe command from the Sysinternals folks to create a single location for editing my start menus. The bundle for doing this can be found here.

With that tool, I modify the start menu as follows:

  • Internet and Internet\Other for Firefox, IE, Thunderbird, Miranda, etc.
  • Multimedia, Multimedia\Creation and Multimedia\Playback for various photo editing, audio recording, DVD creation tools.
  • Tools, Tools\Security and Tools\PowerToys for 7Zip, AVG/Symantec, TweakUI, etc.
  • Accessories\Hardware for Novell junk, Driver tools, etc.

Environmental Variables

I set the following local (as opposed to global) environmental variables from the get-go. These are set by pressing WIN-PAUSE, clicking the Advanced tab, and clicking the Environmental Variables button. This allows my setup to work on systems with or without a D: drive (which I prefer, but which is not always practical.)

LOCAL=x:\local
HOME=%local%\home
DESKTOP=%userprofile%\desktop
DOWNLOADS=x:\downloads
PATH=%local%\shortcuts;%local%\tools

Unfortunately, this doesn't work quite right. The PATH variable can't contain nested variables, since they won't be broken down. Either expand them manually, or use the batch file and the required setx.exe command (from the XP SP2 admin tools package) to set these up, which can be found here.

Shortcuts Folder

I rely heavily on the run line (and the WIN-R shortcut key to access it) and a large set of shortcuts in a folder added to the PATH environmental variable. This allows me to pull up the run dialog with one keystroke and execute a one-word command to do many functions.

I use a folder named %local%\shortcuts to do this (the LOCAL environmental variable points to either c:\local or d:\local).

In that folder are a number of .lnk files to programs. Not the least of which is a shortcut named shortcuts that is a link to the shortcuts folder :-) Whenever possible, these links use the environmental variables listed above rather than direct file links to make them portable across systems.

Some example shortcuts:

  • key – a shortcut to a private key to be loaded by Pageant (part of PuTTY) for key-based authentication to SSH hosts.
  • putty or ssh – easier than clicking on the SSH client
  • home, www, tfn – shortcuts to PuTTY with a –load argument to connect to a specific server
  • hosts – open the %systemroot%\system32\drivers\etc\hosts file in an editor

cmd_shortcuts folder

In addition to these shortcuts, I also use a custom init.cmd file to customize all of my CMD.EXE sessions. In particular, I add a reference to a cmd_shortcuts folder to the PATH environmental variable when that instance of CMD loads. That way, the additional command-line-only shortcuts that are found in that folder only take effect when CMD is open. Since I add it to the path before the shortcuts folder, I can also override some shortcuts with command-line-specific versions.

NOTE: Do not allow this script to echo anything – weird results happen when text is output every time CMD loads – lots of behind-the-scenes stuff uses CMD and they often expect a quiet load.

init.cmd

@echo off

set path=%local%\cmd_shortcuts;%local%\tools;%path%
set GIT_SSH=%local%\tools\ssh.exe

Here is the registry patch to cause this init.cmd file to be processed every time CMD.EXE loads.

init.reg

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Command Processor]
"AutoRun"="%local%\\cmd_shortcuts\\init.cmd"

cmd_shortcuts scripts

There are a few scripts that are particularly useful in the cmd_shortcuts folder:

cdd changes to the desktop. If a parameter is specified, it will try to change to the first directory that starts with that parameter. So, if you have a “Dev Projects” folder on your desktop, and you type cdd d you'll end up in that folder (unless there's another folder starting with D on the desktop)

cdd.cmd

@cd /d %userprofile%\Desktop\%1*

cdp is like cdd, but it changes to the projects folder (or a subfolder, if an argument is passed) NOTE: Change this folder if the projects folder is elsewhere…

cdd.cmd

@cd /d %local%\projects\%1*

gen is a slick shortcut for rails development. I got sick of typing ruby script\generate, and was even more annoyed to have to remember to cd to the root of the project. This script searches up from the current directory to find the nearest scripts folder and execute the generator script. It's easily modified for other rails commands – like server (which I did as srv)

gen.cmd

@echo off
set command=generate
for %%c in (..\..\..\.. ..\..\.. ..\.. .. .) do if exist %%c\script\%command% set location=%%c
ruby %location%\script\%command% %1 %2 %3 %4 %5 %6 %7 %8 %9

Even better, here's a generic version that allows you to specify the script\ command to execute. Useful for things like r console or start /MIN r server:

r.cmd

@echo off
set command=%1
for %%c in (..\..\..\.. ..\..\.. ..\.. .. .) do if exist %%c\script\%command% set location=%%c
ruby %location%\script\%command% %2 %3 %4 %5 %6 %7 %8 %9

Yet another, similar, script that loads the GVIM with the rails project up (requires the rails.zip plugin for GVIM):

rvi.cmd

@echo off
for %%c in (..\..\..\.. ..\..\.. ..\.. .. .) do if exist %%c\README set location=%%c
cd %location%
gvim README -c Rproject
it/os/windows/start.txt · Last modified: 2008/09/02 18:52 (external edit)
Creative Commons License Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed