Setting up Paths to Command Line Executables in Windows

This tip is for students who run a Windows operating system but are interested in the convenience of executing certain quick operations from the command line. Useful command-line tools related to software development that you might use in a course include python3, pydoc3, javac, java, javadoc, csc, and al. There are also handy tools only available in this way. They include handy network tools like ping, tracert, and nslookup. In Windows, the "command line" is accessed via the tool named cmd, PowerShell, or one of the free, more powerful shell-like tools available for download.

Please refer to this screen shot in the instructions that follow.

Note: Some things, like the network tools above, are available automatically without going through the procedure above. You mostly need to follow this procedure when you have installed additional tools.

0. Make sure you know where the executables for the command line tools you want to run have been installed. You will need the directory names.

1. Open System Properties. One way is from the Computer icon's menu. Select "Properties", then "Advanced". You can also get to it from the Windows Control Panel. Look for "System"-"Advanced"

2. Make sure the "Advanced" tab is showing. Choose "Environment Variables".

3. You'll see two areas. One for settings just for you, the current user, and one that affects the "system", i.e., everyone. If you expect there to be a need across multiple accounts and you have administrative privileges on the computer, choose the bottom pane. Otherwise, the top pane is fine, and has fewer consequences if you make a mistake.

4. Look at the list of variables. If you see "PATH" (unlikely), choose the "Edit..." button. If not, hit the "New..." button.

5. Name the variable PATH. Add the directories containing any command-line executables you hope to use.

In the above example, there is but one: the location of the command-line tools for Java (version 8, release 31). If you add more than one directory, separate them with semicolons, like this:

C:\Program Files\Java\jdk1.9b\bin;C:\Python\bin;Z:\mybin

6. That's it! Hit "OK" in the dialogs in the reverse order in which you opened them. Test that you did things correctly by running "cmd" (enter that text in the Start menu's search field), and seeing if you can run your favorite commands.