PATHEXT environment variable - DOS/Command Prompt Reference
[Windows NT series] The environment variable ‘PATHEXT’ in the Command Prompt holds a list of extensions that serve as candidates when opening a file with an omitted extension.
Details
The list of extensions to set in the PATHEXT variable is specified as a string separated by semicolons ‘;’ and containing extensions with the period ‘.’ character, such as ‘.COM;.EXE;.BAT;.CMD’ (similar to specifying PATH).
* The search order when opening a file varies slightly depending on the version of Windows, such as whether the omission of extensions for executable files like .EXE is prioritized in the search or not. Therefore, when using the functionality of PATHEXT to open a file with the same name as an executable file located in a directory listed in Path, it is important to be cautious when omitting the extension.
* Path can also be used as a command, but since PATHEXT is nothing more than an environment variable, you cannot use PATHEXT like ‘PATHEXT .COM;.EXE;.BAT’.
Samples
Sample
set PATHEXT=%PATHEXT%;.PL;.PY;.RB
Adds ‘.pl’, ‘.py’, and ‘.rb’ to PATHEXT to be able to open files with these extensions without specifying the extension in the current prompt.
* To set PATHEXT on a per-user basis, go to User Settings in the Control Panel. If you want to set PATHEXT system-wide, open the Environment Variables settings from the computer's properties. (Note that per-user settings may not exist; in that case, you can create them by copying and adding values from the system settings.) Also, you can use the Setx command to configure it.