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

Published Sunday, April 11, 2004 12:54 PM by puzzlehacker

Comments

# re: Customizing Windows Run Command...

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.

Sunday, April 11, 2004 3:23 PM by Wes

# re: Customizing Windows Run Command...

Everything you just listed plus:
inetmgr - IIS Manager
services.msc - Services SnapIn
eventvwr.msc - Event Viewer SnapIn
And of course replace notepad with UltraEdit

Sunday, April 11, 2004 3:26 PM by Dan Bright

# re: Customizing Windows Run Command...

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...

Thursday, May 6, 2004 10:14 PM by Brian Desmond

# re: Customizing Windows Run Command...

I use:

runas /user:administrator cmd

a great deal.

Friday, May 7, 2004 4:59 AM by John Topley

# re: Customizing Windows Run Command...

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.

Tuesday, May 11, 2004 8:15 AM by VORTEX

# re: Customizing Windows Run Command...

I'm trying find the target for the Run command. We are already using the practice of "runas" on our apps so we can run administration utilities under a domain admin account. We'd like to run the "run" command as a domain admin so when we navigate to network file resources, we can see/change securities, etc., under the domain admin account. Anyone know how to create a shortcut to "Run" that can be edited to "runas"?

Friday, May 28, 2004 1:40 PM by Damon

# re: Customizing Windows Run Command...

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.

Tuesday, June 22, 2004 11:08 PM by Forgetful

# re: Customizing Windows Run Command...

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.

Friday, July 30, 2004 9:29 AM by Dan

# re: Customizing Windows Run Command... How to

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

Tuesday, August 1, 2006 12:11 AM by KSK

# re: Customizing Windows Run Command...

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

Tuesday, August 1, 2006 1:41 AM by puzzlehacker

# re: Customizing Windows Run Command...How to , problem persists ;(

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...

Wednesday, August 2, 2006 1:29 PM by KSK

# Customizing

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

Thursday, August 17, 2006 7:45 AM by Zen

# re: Customizing Windows Run Command...

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

Thursday, September 21, 2006 12:59 AM by Raymond

# re: Customizing Windows Run Command...

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)

Thursday, December 7, 2006 2:24 PM by Drew

# re: Customizing Windows Run Command...

<h1> thanks for this tutorial. It works great on my windows machine. </h1>

Tuesday, January 9, 2007 6:42 AM by Bijesh

# re: Customizing Windows Run Command...

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

Thursday, January 11, 2007 1:39 PM by MMJ

# Clearing the cache list

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?

Sunday, March 18, 2007 11:46 AM by 110102

# re: Customizing Windows Run Command...

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 :)

Sunday, May 6, 2007 5:19 PM by mathijs

# re: Customizing Windows Run Command...

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

Saturday, June 2, 2007 11:08 PM by Fernan Vecina

# re: Customizing Windows Run Command...

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

Thursday, July 5, 2007 8:14 AM by Praneeth

# re: Customizing Windows Run Command...

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?

Thursday, October 11, 2007 7:14 PM by Bryan

# re: Customizing Windows Run Command...

This is so great. Thanks

Tuesday, October 30, 2007 4:03 AM by Jinn

# re: Customizing Windows Run Command...

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.

Monday, December 10, 2007 11:36 AM by JS

# re: Customizing Windows Run Command...

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?

Tuesday, December 18, 2007 6:42 PM by Bill

# re: Customizing Windows Run Command...

Huzzah! This is so helpful for PuTTY. Thanks.

Sunday, February 10, 2008 5:10 PM by Braden

# re: Customizing Windows Run Command...

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

Wednesday, April 30, 2008 5:05 PM by jim

# re: Customizing Windows Run Command...

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.

Monday, May 19, 2008 9:29 AM by Sameer Chaudhary

# re: Customizing Windows Run Command...

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

Tuesday, June 10, 2008 4:39 AM by Blankdragon

# re: Customizing Windows Run Command...

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).

Saturday, June 14, 2008 4:36 PM by Sean

# re: Customizing Windows Run Command...

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

Tuesday, June 24, 2008 9:06 AM by AlaskaJohn

# re: Customizing Windows Run Command...

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.

Monday, July 21, 2008 2:43 PM by Nathan

# re: Customizing Windows Run Command...

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\

Saturday, September 13, 2008 9:06 PM by Shawn

# re: Customizing Windows Run Command...

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.

Wednesday, October 15, 2008 10:00 PM by Pandian

# re: Customizing Windows Run Command...

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

Monday, March 30, 2009 3:05 PM by CopyCat

# re: Customizing Windows Run Command...

Wicked, my first registry adjustment works just fine!

Tuesday, April 21, 2009 6:00 AM by Arjan

# re: Customizing Windows Run Command...

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

Thursday, May 21, 2009 10:30 AM by Brian

# re: Customizing Windows Run Command...

very useful! thanks

Friday, November 6, 2009 9:10 AM by Michal Linhard

# re: Customizing Windows Run Command...

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.

Friday, December 3, 2010 4:39 PM by rv

# re: Customizing Windows Run Command...

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.

Friday, December 3, 2010 4:48 PM by rv