In two words, .cmd wrappers.
I keep my win32 PATH
environment variable short. Really short. Like, there are some default
windows folders that have to be there, I keep it to that plus one more
directory. Theoretically, you could just put the wrappers in one of the
system directories and have the shortest path ever. The output of the PATH command should never be longer than:
PATH=F:\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem
Why? I like to think it's because I was burned at work
one-too-many times by my PATH being so long it broke the build. There's
a limit on how long it can be, I think it's some max string length of
windows (248 characters? I can't even remember now). Now I think it's
because I'm an anal control freak about my puter and how it works.
Write one little batch file for each .exe and batch you ever need to run. And you put every batch file in one directory, and you add that to your PATH. You laugh at me now, but look who has the shortest PATH ever! You too can have a super-short PATH, and here's how.
Write one little batch file for each .exe and batch you ever need to run. And you put every batch file in one directory, and you add that to your PATH. You laugh at me now, but look who has the shortest PATH ever! You too can have a super-short PATH, and here's how.
- Get a new sexy Western Digital raptor hard drive, or create a partition or file share for your wrappers. Shortest PATH is win32 defaults plus a 3-letter drive like 'F:\'.
- You can also install everything here, nice!
- Note down your current PATH, because for sure we're going to break something for a little while.
- Add your new drive directory to your PATH, and remove any other directories that look like software put them there. Keep anything that looks like 'C:\Windows'
- Write a small batch file for each .exe you actually use. Do this one-at-a-time, or else you'll never catch typos.
- Use 'start' for gui programs so you can spawn them without the pesky cmd shell hanging around.
- Use 'setlocal' and 'set PATH=F:\application\installed\here;%PATH%' liberally.
- Use '%0' and its expanded friends '%~dp0' so you can copy and paste your wrapper to do the next one.
- Make 'F:\creator7.cmd'
- Edit it to prepend the common directory to its setlocal'd PATH.
- Edit it to prepend 'c:\Program Files\Roxio\Easy Media Creator 7\Creator Classic\' to its setlocal'd PATH.
- Edit it to start %~n0.
- Copy it to 'F:\backupnow.cmd' once it works right.
Hopefully you get (and never have to use) the idea. Sometimes, I really do miss my Mac.:setup
@echo off
setlocal
PATH=%~dp0vim\vim64;%PATH%
start %~n0.exe %*
exit /b %ERRORLEVEL%
Leave a comment