Pregunta

Where is in the registry the path executed when I run the "notepad" command in windows "Start->run command" interface? I want to change it for notepad++ (it is required so, although could look not really good)

¿Fue útil?

Solución

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?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top