If you’re unable to launch programs without having to type the extension “.exe” in a Command Prompt window, you need to fix your PATHEXT variable.
For instance, Notepad may launch correctly when you type Notepad.exe, but not when typing Notepad. The latter might show you the following error:
‘notepad’ is not recognized as an internal or external command,
operable program or batch file.
This happens if
.EXE is missing in the PATHEXT variable. Use these steps to fix the problem
Reset PATHEXT variable
Press WinKey + R, type
SystemPropertiesAdvanced.exe, and press ENTER
Click Environment Variables, and double-click PATHEXT
Set the PATHEXT value as follows:
Quick Tip #1
To add additional extensions there, such as .PL, add a semi-colon (separator) and then followed by the file extension. Such as:
Quick Tip #2
When you run a command or program without mentioning the extension, Command Prompt uses the value of PATHEXT variable to determine which extensions to look for and in what order.
If you have two files named “test.bat” and “test.vbs” in a folder, running “test” from a Command Prompt window would launch “test.bat”, because .BAT appears at the beginning of the PATHEXT variable. By moving .VBS to the front (after .EXE), you can make Command Prompt to launch “test.vbs” instead of “test.bat”. However, it’s advisable to use the default order unless you have some special requirements.