"Run" command discovery – aha! that’s how

A simple task, …I wanted to pull up some system information quickly to check what memory exists on a server and so brought up Run in Windows Server 2003. Then I thought the command was “System32” so I entered that; the result I got was unexpected but nevertheless cool. (BTW “msinfo32” would have been the correct command) I was instead taken directly to C:\Windows\System32.

What I then wondered is what other such alias paths might exist. Is this simply a result of the Path variable? What makes this work and can I add my own shortcut/aliases. Is the plural form of alias – aliases or aliai? …but I digress

So I Googled this for myself 😛 … and learned some interesting stuff which I’ll share:

http://weblogs.asp.net/whaggard/archive/2004/04/11/111232.aspx

The run command (ShellExecute, as you said) also supports keyword expansion, so you can type any special path that’s in your environment variables and go the the appropriate directory:
My Documents
System32
Temp
ProgramFiles
HomePath
AppData
etc.
To see what’s in your list: win-r, cmd, set.

And also this quote off that same page:

After thinking about if awhile I hunted down how the run command works.  It turns out that it makes a call to ShellExecute, which I guess is not too surprising.  The next thing I wanted to find out was exactly how the commands are resolved. The following is an ordered list of how they are resolved ([1]):

· The current working directory

· The Windows directory (no subdirectories are searched)

· The Windows\System32 directory

· Directories listed in the PATH environment variable

· The App Paths registry key

And here are lists of several hundred commands that can be invoked via Run:

· http://www.usp.br/fzea/admin/files/2061_Windows Run Commands.htm

Leave a comment