How-To

How to Set the PATH System Variable for Windows

Are you getting an error:” ‘xxxx’ is not recognized as an internal or external command, operable program or batch file”? Time to update your PATH System Variable.

When working in the Windows command line interface (cmd.exe), there are many times when you want to run an executable that’s located in another folder. Most often, this folder is C:\Program Files or a sub-directory thereof. For your convenience, many Windows installers will automatically update your system PATH environment variable so you can type the name of the executable from any directory and run that .exe file. For example, notepad.exe is located in C:\Windows\System32. But you can type “notepad” in the command line from any directory and it’ll launch notepad.exe.

Not all program installers will modify your PATH environment variable to enable this. Fortunately, you can set or modify the PATH system variable in Windows very easily. Here’s how:

Click Start –> Computer –> System Properties.

set path variable in windows environment

Click Advanced system settings.

PATH variable in Windows 7

From the Advanced tab, click Environment Variables…

Windows 7 environment variables

In the bottom pane, scroll down to the variable named Path. Select it and click Edit.

SYSTEM variables in Windows 7 (PATH)

In the variable value field, add a semicolon and then the path where the .exe you want to run from the command line is located. Be careful not to delete anything that’s already in the field, otherwise you might break another program.

For example, I’m adding C:\Program Files\SendEmail by pasting in only the selected text in the screenshot.

changing PATH variable in Windows 7 command line

When you are done, click OK. If you have cmd.exe open, close it and re-open it. Test out your modified PATH variable by typing in an .exe from the path you just added.

Before you made this tweak, you would’ve gotten the error: ‘xxxx’ is not recognized as an internal or external command, operable program or batch file.

cli error: sendemail is not recognized as an internal or external command, operable program or batch file

After the tweak, the executable will run no matter what directory you are in.

sendemail path variable fixed

And that’s all. Not a hugely life-changing tip on its own, but combined with some other groovy tips I’ve got in store, it’ll make a world of difference. Stay tuned Winking smile

1 Comment

1 Comment

  1. Anonymous

    February 17, 2013 at 7:52 pm

    Here is the step by step tutorial I follow to set PATH for Java in Windows 7 and Windows 8

Leave a Reply

Your email address will not be published. Required fields are marked *

 

To Top