Add a single exe in given directory to PATH environmental variable

(Note: I know this is almost 3 years old, but I landed on this page by searching a similar question, so I'm writing the correct answer here for anybody else coming here)

Yes, it is possible, it's even preferred to do this instead of cluttering the PATH variable. You need to add a key under the registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths (for the machine) or HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths (for the user - preferred).

The format is the same in both cases, the key name should be utility-5.exe and the registry default value should be D:\utils\utility-5.exe.

There are more information (including several more stuff you can do) on MSDN and by Raymond Chen

EDIT: (some years later):

This won't (by design) work with Command Prompt (cmd) or PowerShell. In the case of PowerShell, you'll want to add a new alias in your $PROFILE, like so:

Set-Alias -Name vlc -Value 'C:\Program Files\VideoLAN\VLC\vlc.exe'

In the case of Command Prompt (cmd.exe), there's similar functionality with DOSKEY:

DOSKEY vlc="C:\Program Files\VideoLAN\VLC\vlc.exe"

This way you don't need to deal with the PATH variable at all.


You can't add a single executable to the path. There may be an alternative to moving it to another directory, though - assuming it's on an NTFS partition, you could create a symlink to the executable in a directory that is in the path using the mklink command.


You will have to put it into a directory.

All the entries in your PATH variable must be directories to be useful. cmd.exe and any other shell or application that uses PATH will try to find the executable corresponding to any command you type by pasting the name of command onto the end of each PATH directory in turn until it either finds the command you asked for or it runs out of directories in your PATH. Any entry that doesn't exist or isn't really a directory will never match anything.