WildlandsTech
How to Create New Environment Variables in Windows 11 - Printable Version

+- WildlandsTech (https://wildlandstech.com)
+-- Forum: Windows Support (https://wildlandstech.com/forumdisplay.php?fid=5)
+--- Forum: Windows 11 (https://wildlandstech.com/forumdisplay.php?fid=22)
+--- Thread: How to Create New Environment Variables in Windows 11 (/showthread.php?tid=559)



How to Create New Environment Variables in Windows 11 - Sneakyone - 09-09-2024

How to Create New Environment Variables in Windows 11

Environment variables in Windows 11 are system-wide or user-specific settings that affect how processes and applications run. These variables can be used to store paths, directories, or any other system configuration details. This guide will walk you through the process of creating new environment variables in Windows 11.

Step 1: Open the System Properties Window

1. Press Windows + S to open the search bar and type Environment Variables.
2. Select the option labeled Edit the system environment variables from the search results. This will open the System Properties window.

Step 2: Access Environment Variables

1. In the System Properties window, click on the Advanced tab.
2. At the bottom of this tab, click the Environment Variables button. This will open the Environment Variables window, where you can view and edit existing variables or create new ones.

Step 3: Create a New User or System Variable

In the Environment Variables window, you have the option to create new environment variables for either the current user or the entire system.

1. Under the User variables section (for the current user) or System variables section (for all users), click the New button.

2. In the New User Variable or New System Variable dialog box, you will need to provide two pieces of information:
  - Variable name: The name of the environment variable.
  - Variable value: The value that this variable should hold. For example, this could be a file path, a folder, or a specific configuration setting.

3. After entering the variable name and value, click OK.

Example: Creating a Path Variable

1. To add a new directory to your system's path, follow these steps:
  - Under the System variables section, scroll down and select the Path variable.
  - Click Edit, then in the Edit Environment Variable window, click New.
  - Enter the full path to the directory you want to add (for example, `C:\Program Files\MyApplication`).
  - Click OK to save the changes.

Step 4: Verify the New Environment Variable

After creating a new environment variable, you can verify that it was added successfully:

1. Open the Command Prompt by pressing Windows + R, typing cmd, and pressing Enter.
2. In the Command Prompt, type the following command to display the value of the variable you created:

 
Code:
echo %VariableName%

  Replace VariableName with the name of the environment variable you created. For example, if you created a variable called MyVariable, the command would be:

 
Code:
echo %MyVariable%

3. If the environment variable was created successfully, the Command Prompt will display its value.

Step 5: Edit or Delete an Environment Variable

To modify or delete an environment variable:

1. Return to the Environment Variables window by following the steps in Step 1 and Step 2.
2. Select the variable you want to modify or delete from either the User variables or System variables section.
3. Click Edit to change its value, or click Delete to remove the variable entirely.

Conclusion

Creating new environment variables in Windows 11 allows you to customize your system's behavior or set specific configurations for applications. By following this guide, you can easily add, modify, or delete environment variables, ensuring your system is set up according to your preferences.