JSI Tip 8561. How can I eliminate the need to type the full path of an executable that is not in my path?

Jerold Schulman

October 11, 2004

1 Min Read
ITPro Today logo in a gray background | ITPro Today


The standard solutions to the above problem are:

1. Create and execute a shortcut.

2. Write a script.

3. Place the folder in your path.

4. Use Command Prompt Here.

Here is an alternate solution:

1. Use the Registry Editor to navigate to HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Paths.

2. Create a sub-key with the name of the executable. Example: MyProgram.exe.

3. Create a Value Name with a null name ((Default) or ) and set the data type to Expandable String Value (REG_EXPAND_SZ).

4. Enter the full path to the executable as the data value.

5. Optionally, add a Path Value Name, a REG_EXPAND_SZ data type, and set its value to the path to any library (DLL) files that are located in another folder.

NOTE: Windows uses the entries if it does not find the application in the current PATH AND the application was launched with the ShellExecute() function. Run and the Start command use the ShellExecute() function.

NOTE: You may use a string (REG_SZ) data type instead of REG_EXPAND_SZ.

When you type MyProgram.exe into the Run line, or use the Start command in a CMD.EXE window or batch, Windows will temporarily add the optional Path value to the beginning of the PATH.

NOTE: Look at HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp PathsWRITE.EXE for an example:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp PathsWRITE.EXE  Name:             (Default)  Type:            REG_EXPAND_SZ  Data:            "%ProgramFiles%Windows NTAccessoriesWORDPAD.EXE"

NOTE: When I installed Windows Media Player, it wrote:

HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionApp Pathswmplayer.exe  Name:             (Default)  Type:            REG_SZ  Data:            "C:Program FilesWindows Media Playerwmplayer.exe"    Name:            Path  Type:            REG_SZ  Data:            "C:Program FilesWindows Media Player"

NOTE: Windows XP SP1 had a problem and added the Path to the end of the PATH. This was fixed in SP2.



Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like