Environment variables in an operating system are values that contain information about the system environment, and the currently logged in user. They existed in OSes before Windows as well, such as MS-DOS. Environment Variables are a set of dynamic named values that can affect the way running processes will behave on a computer. For example, a running process can query the value of the TEMP environment variable to discover a suitable place to store temporary files, or the AppData variable to find a quick way to get access to the Roaming folder in the user’s profile folder.
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.
For other methods, check out our detailed tutorial:
Applications or services can use the information defined by environment variables to determine various things about the OS, for example, to detect the number of processes, the currently logged in user's name, the folder path to the current user's profile or the temporary files directory.
The PathExt Environment Variable
PathExt is an environment variable that stores a list of file extensions for the operating system to execute. When you run 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, for example, first .com, then .exe, .bat, .cmd, which is the default value saved in PathExt on Windows 10.
To see the value of the PathExt variable, run the following command in the command prompt.
It is easier to make changes to
PathExt through the Environment Variables dialog box. Double click on the PathExt variable and make your changes in the dialog that appears, then click OK to save your changes.
Here are some notes
Note # 1: If the
.exe extension is not in the PathExt, you will need to enter the full filename, including the .exe extension, to launch it from the command line. For example, if you just type notepad, the Notepad application will not start. You will need to type notepad.exe to run it.
Note # 2: If you have 2 files named
test.bat in a folder, running the
test command line will always run
test.exe first. That's because the system uses the PathExt value to determine which extension to use and in which order.