[Fix] Cannot Run Programs Without Typing the Extension (.EXE) in Command Prompt

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.

cannot run programs without typing .exe extension pathext

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:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC

cannot run programs without typing .exe extension pathext

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:

.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC;.PL

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 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.

About the author

Ramesh Srinivasan founded Winhelponline.com back in 2005. He is passionate about Microsoft technologies and has a vast experience in the ITeS industry — delivering support for Microsoft's consumer products. He has been a Microsoft MVP [2003 to 2012] who contributes to various Windows support forums.

Leave a Comment