Environment variables are not often seen directly when using Windows. However there are cases, especially when using the command line, that setting and updating environment variables is a necessity. In this series we will talk about the various approaches we can take to set them. In this post we use the System control panel to interface with the environment variables.

Go to the Start menu

Click on Control Panel

If you are viewing the Control Panel window by Category, click on the Category and then click on Small icons

Click on the System control panel.

Click on the Advanced system settings link on the left side of the window

Click on the Environment Variables... button.

To add a new System variable, click the lower New... button, the one under System variables.

For this example we will set the variable name to EC2_HOME, and the variable value to %APPDATA%\aws\ec2-api-tools.

Variable name:  EC2_HOME
Variable vaule: %APPDATA%\aws\ec2-api-tools

Once that is typed in, click OK.

We will now append the Path system variable. Scroll down on the bottom pane and click on the Path variable. Then click the Edit... button.

We will add ;%EC2_HOME%\bin to the end of the variable value:

Variable name:  Path
Variable value: ...;%EC2_HOME%\bin

Then click the OK button.

Click OK in the Environment Variables window.

Click OK in the System Properties window.

Open a new command prompt, it has to be a new one, ones that are open already will not pick up the change, and see the newly set environment variable.

Command Prompt - C:\>

echo %EC2_HOME%



Parts in this series