As Arakel has said, there are here two unrelated features:
- Environment variables that are used as
%variable%, for example %USERPROFILE%
- Commands that one enters without
%...%, for example documents.
Actually, the first ones are just macros that have values.
The syntax %...% just converts the variable-name to text,
and this text is then executed as if it was typed into the Run box.
The entered text is first searched in the folders specified by the PATH environmental variable
and in %USERPROFILE%. In this case the entire entered text must equal the folder name.
Examples here are "documents" for C:\Users\<user>\Documents or "videos" for
C:\Users\<user>\Videos.
If a folder by that name was not found,
the first word typed into the box is taken as a command, while the following ones
are taken to be parameters. Words containing separators such as blanks need to be quoted.
If the entered command-name does not match a folder name, Windows will try to find an
executable in the PATH that has that exact name. If the command does not have a suffix,
Windows will try all executable suffixes such as .exe or .bat (and some more).
There are virtually hundreds of command-names that can be entered this way.
For example, typing calc will start the Windows calculator, which is the executable file
C:\Windows\System32\calc.exe, because C:\Windows\System32 is in the PATH.
One can create one's own Run commands, in this way :
- Win+R to open the Run dialog
- Enter
%windir% to open the Windows directory
- Alt+F W S to open the File menu, choose the New menu item, then the Shortcut menu item
- Go through the wizard to create a shortcut to the desired program or folder
- The name you give to the shortcut is what you will type in the Run box to start the program.
Another method is done via the registry (not recommended).
Microsoft calls it Application Registration.
Run Regedit and navigate to following key:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths
Right-click on the App Paths key and select the New / Key command.
- Give the new key a name of 2-8 characters name followed by
.exe
- Change the value if the
(Default) item to the full path to the program.
For example,
this sample registry file lets one type ie in the Run box to open 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"