Create new system variable available without restart
A common question!
In Windows, you can create a new system variable without restarting your computer. Here's how:
Method 1: Using the System Properties
- Press the Windows key + Pause/Break to open the System Properties window.
- Click on the "Advanced" tab.
- Click on the "Environment Variables" button.
- Under "System Variables", click "New".
- Enter the name of the new variable in the "Variable name" field.
- Enter the value of the new variable in the "Variable value" field.
- Click "OK" to close all the windows.
Method 2: Using the Command Prompt
- Open the Command Prompt as an administrator. You can do this by right-clicking on the Start button and selecting "Command Prompt (Admin)".
- Type the following command and press Enter:
setx NEW_VARIABLE_NAME "NEW_VARIABLE_VALUE"
Replace
NEW_VARIABLE_NAME
with the name of the new variable andNEW_VARIABLE_VALUE
with the value of the new variable.
For example:
setx MY_NEW_VAR "Hello World"
This will create a new system variable named MY_NEW_VAR
with the value "Hello World"
.
Method 3: Using the Windows Settings App
- Open the Windows Settings app by searching for "Settings" in the Start menu.
- Click on "System" and then click on "About".
- Click on the "Advanced system settings" link on the right side of the window.
- Click on the "Environment Variables" button.
- Under "System Variables", click "New".
- Enter the name of the new variable in the "Variable name" field.
- Enter the value of the new variable in the "Variable value" field.
- Click "OK" to close all the windows.
Once you've created the new system variable using any of these methods, you can verify that it's been created by opening a new Command Prompt window and typing echo %NEW_VARIABLE_NAME%
. If the variable was created successfully, you should see the value you specified.