Customizing Windows Run Command...

If you are like me you use windows run command all the time.  I hate using the mouse to point and click a shortcut on the start menu.  WIN-R are probably the two most over used keys on my keyboard.  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

Naturally the next thing I wanted to do was customize existing commands or add new commands so I do not have to type as much (standard lazy approach).  After examining my options which were to put the executable in one of those paths (since it only locates executables and not shortcuts), modify the path environment variable or add a key to App Paths. The App Paths option seems to be the easiest and most flexible to me.  Here is a layout of what you need to do to add an App Paths entry ([1]):

HKEY_LOCAL_MACHINE
    SOFTWARE
        Microsoft
            Windows
                CurrentVersion
                    App Paths
                        file.exe
                           (Default) = The fully-qualified path and file name
                           Path = A semicolon-separated list of directories
                           DropTarget = {CLSID}

Disclaimer: Modifying the registry can cause serious problems that may require you to reinstall your operating system. I cannot guarantee that problems resulting from modifications to the registry can be solved. Use the information provided at your own risk.

The minimum needed to add a new entry is to add the key file.exe where file is the string you want to type into the run command and to add the Default entry which is the fully-qualified path to the file you want to execute. Note that even it the file you are going to reference isn't an exe file you still need to put the .exe on the key. Here is a sample registry file that I created to add a shorter keyword for Internet Explorer:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\ie.exe]
@="C:\\Program Files\\Internet Explorer\\iexplore.exe"

After entering that entry into the registry I can simply type “ie” at the run command to open internet explorer.

Here is a list of some common commands I use at the run command:

  • cmd – Command prompt
  • winword – Microsoft Word
  • excel – Microsoft Excel
  • outlook – Microsoft Outlook 
  • iexplore – Internet Explorer
  • firefox – Mozilla Firefox
  • notepad – Notepad
  • compmgmt.msc – Computer Management Console
  • control appwiz.cpl – Add/Remove programs dialog
  • mstsc – Microsoft Terminal Service Client
  • regedit – Registry Editor

If there is some program that I find myself using all the time I figure out what the run command is for it and if there is not a short easy one I add one to my App Paths as described above.  Does anyone else have some other common run commands they use?

 [1] http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_extending/fileassociations/fa_perceived_types.asp

38 Comments

  • Yes I did forget about those. Also lets not forget about the intellisense for the directory structure. Meaning when you start typing a directory it gives you a drop down list of the files/directories that match what you have typed so far.

  • Everything you just listed plus:

    inetmgr - IIS Manager

    services.msc - Services SnapIn

    eventvwr.msc - Event Viewer SnapIn

    And of course replace notepad with UltraEdit

  • I pretty much use everything in your list. I don't really use a start menu much. I just use env variables and program names i know...

  • I use:



    runas /user:administrator cmd



    a great deal.

  • instead of compmgmt.msc, i use mmc at the run dialog.

    also lusermgr.msc

    and gpedit.msc

    most things are run from the winkey+r>cmd prompt



    and if you are on 98/me/etc. you can goto the command folder and add in your own shortcuts, just drag in the command folder and rename it to what you want, then simply hit winkey+r and type it in.

  • I somehow erased my run commands. The ones I use are msconfig and something that let me see if I was connected to and ISP. Could you tell me what that was for ME? Thanks-obviously I only know enough to be dangerous.

  • Amazing, just amazing. I've been meaning to figure this out for a while, but thanks to google and you, my life has been greatly improved. As soon as i saw the list of programs that i usually type i changed like 15 of them to only a few characters. Thanks a lot.

  • Hi,
    I want to remove the entries from the run command, like if any url addresses or file names that was opened recently appears on the run command line.
    I tried clearing the cache, history log and Temporary folders, still I'm able to see those files and URL addresses in run command. How to remove them, I need to remove them as I'm using a common machine, I don't want others to see those files even on run command.

    -KSK

  • To remove the history you need to clean all the values from the HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU\ key in the registry.

  • Thanks for your inputs Puzzle Hacker, but the problem still persists, between I use WIN xp professional and IE 6... if you have anyother solutions let me know , I will try it out...

  • Have you tried changing the layout of your windows? this may help a friend had trouble on this.

  • Thanks for this tutorial. It works great on my windows machine:D

  • Hey,
    Nice entry. I'm a hard core keyboard junky too. I'd like to customize the run program. Any ideas on how to do this without a rewrite? When you type text into the textarea a dropdown list is populated with the files location in the path you type. (Typing c:\temp displays all of thoes files.) But the width of the dropdown is too short! I want that dropdown to default to the width of the screen. Anyway to do this? I've been using spy++ to try to get a handle on that control. But no luck, I could rewrite run I guess.

    Any ideas? runcmd.20.zdux0012 (at) xoxy.net

    btw
    (Check out AutoHotKey, Logitech's G15, and the following keyboard shortcuts: Alt+Space, Alt+Space+n, Alt+Space+x, Alt+Space+s then right arrow key then move the mouse)

  • thanks for this tutorial. It works great on my windows machine.

  • I was really looking for this. Thanks so much! :)

  • hey i tried to delete those files that you said for the runrmu but they are still there. what do you mean by changing the layout of windows?

  • Hi,

    You also can put shortcuts into C:\Windows\System32 and then type in the name of the shortcut in the run bar and it will work :)

  • Wew its great help... dang I spent almost 30minutes just too look for this solution :)

  • Wow!! Its great. Thanks a lot for your help.

  • I am still looking for the answer to this question, and I hope someone here can help.

    I need to know what to paste into a shortcut to make the "Run" dialog to pop up.

    Any ideas?

  • This is so great. Thanks

  • This is great!

    I realise now that i'm not the only one who hates to "search and click" for applications!

    The way I choose do to it was addind a folder to the path and placing shortcut into that path. This is easier for me to sync it between my computers.

  • Brainstorm Question:

    I surfed to this forum seeking a way to customize the Run Command. In trying to build a better kiosk, I would like to keep the Run Command accessed from the Start button (rather than remove it, possible via regedit.) Is there a way to add a password condition in order for Run to execute a command?

  • Huzzah! This is so helpful for PuTTY. Thanks.

  • shutdown -i on network computers and you type an ip address in add and shut down other peoples computers hahaha

  • these are really useful commads for time-saving. For the first time, I realize that we have to play with our computer to learn more and also finding the easier method of doing our existig routine job.
    Thanks for this useful information.

  • When combined with VBS-scripts, this tip can be used to create helpful shortcuts to Google searches, etc...

  • Great tips, but if you're really into this, perhaps an alternative program would be useful. Executor (linked) is great, portable and free. Works without administrative rights too (I use it at college).

  • In answer to above questions... shortcuts to access run command should point to cmd.exe

  • Great tips!

    I'm running XP Pro and IE6, and I had to clear "History" in Internet Explorer before my Run cache was completely cleared.

  • I've always created shortcuts and placed them in C:\windows. It worked well until I tried to add a shortcut with the same name as a directory with the same name. Using the App Paths registry key, you can gain precedence over the shortcuts/directories/files located in C:\Windows\

  • Win Xp2002-SP2.I dont have the run command in the start menu.I ve gone through all options in customize start menu .. but i couldnt find an option to add run command.
    Iam also an admin user in my home p.c.Plz help me with this.

  • %windir%\system32\rundll32.exe shell32.dll,#61

  • Wicked, my first registry adjustment works just fine!

  • I have an internal only html page and I would like the user to be able to click a link that will invoke the run command on an ip address allowing a user to log in. Any ideas??

    Thanks

  • very useful! thanks

  • You can also just drag a shortcut for any folder or app into your base user directory (C:\Users\usernamehere). Typing the name of any shortcut in that base directory into the run cmd will bring up whatever it links to.

  • Also - Shortcuts in the base level of any directory added to the path environmental variable will work in the run cmd. So you can add a links folder to the paths if you don't want to clutter up any of the system folders.

Comments have been disabled for this content.