What is the PathExt Environment Variable in Windows?


Environment Variables are a set of dynamic named values that can affect the way how the applications behavior on a computer. For example, when deciding where to store temporary data, an app can query the TEMP environment variable to find out a suitable location Windows system has put in place.

You can get a full list of environment lists that are available for you by running the command line set in a command prompt window.

Command Prompt - set

Or the Environment Variables dialog box by opening the System Properties and clicking Environment Variables button.

Environment Variables

The PathExt is an Environment Variable that stores a list of the file extensions for operation system to execute. When running a command line that does not contain an extension, the system uses the value of this environment variable to determine which extensions to look for and in what order, such as .com first, follow by .exe, .bat, .cmd, which happens to be the default value stored in the PathExt by Windows.

To find out what’s in the PathExt, run the following command in the command prompt window.

echo %pathext%

Cmd - echo environment

To make changes to the PathExt, it’s easier through the Environment Variables dialog box. Double-click the variable PathExt, and make changes in the dialog that pops up, then hit OK to save the changes.

Edit System Variable

Note #1: If .exe is missing in the PathExt, you will have to type the full filename including the .exe extension to run the command line. For example, typing just notepad won’t launch the Notepad app for you. You will have to type “notepad.exe” to launch it.

Note #2: If you have 2 files called test.exe and test.bat in a folder, running test in the command prompt will always start test.exe first. Why? That’s because the system uses the value of PathExt to determine which extension to use and in what order.



Please enter your comment!
Please enter your name here