11 Ways to Set Environment Variables on Windows 3
Setting environment variables on Windows 11 can help you customize your system, run scripts, and configure applications.
In this guide, we'll discuss three methods along with step-by-step instructions so you can configure your system to your liking.
There are three types of environment variables
- System Environment Variables – Global variables are the lowest priority, accessible to all users and applications on Windows, and are typically used to define system-wide settings.
- User Environment Variables – The higher the priority, these variables only apply to the current user and process running under that account, and are set by the user or application running under that account .
- Process Environment Variables – With the highest priority, they are temporary and apply to the current process and its sub-processes, providing runtime information or customization to the program.
How to set and use environment variables on Windows 11?
1. Using the Settings app
- press to open Settings. WindowsI
- Go to System and click About.
- Click the Advanced System Settings link.
- In the "System Properties" window, click "Environment Variables".
- Next, in the Environment Variables window, you will see two types of variables. Select an option from User Variables in User or System Variables and click New.
- In the following window, type the variable name without any spaces, and for the variable value, click the Browse Directory or Browse for File button.
- Select the path and click OK.
2. Use the Command Prompt
- key, type cmd in the search bar, and click Run as administrator. Windows
- To add a temporary variable to the system, use this command after replacing the variable name and variable value with the desired variable and hit: Enter
<strong>set VariableName = Variablevalue</strong>
- set command is used to define an environment variable in the process, which is ignored , and is deleted after the window is closed.
- To set an environment variable permanently, type the following command after replacing Variablename with the variable name and Value with the value you want to set, and then press: Enter
<strong> setx Variablename Value /m</strong>
- Type the following command to list path variables and click: Enter
<strong>echo %PATH%</strong>
- Copy and paste the following command to add another variable to the path directory; replace the PATH value with the path you want to add and press: Enter
<strong>setx PATH "%PATH%; PATH Value</strong>
- Refresh the "Environment Variables" window to see the newly added path.
3. Use Windows PowerShell
- key, type PowerShell, and then click Run as administrator. Windows
- Type the following command to list path variables and press: [Environment]::GetEnvironmentVariable("PATH") Enter
- Copy and paste the following command to replace PATH in Declare a path variable after the path to be added and clicked: Enter
<strong>$Variable_Name = "PATH"</strong>
- To change the variable To add to the list of path variables, use this command after replacing the folder PATH with the path you declared and press: [Environment]::SetEnvironmentVariable("folder PATH", "$PATH;$Variable_Name") Enter
- Restart the computer for the changes to take effect.
You can use any method to add new or missing environment variables to prevent the system from Problems such as input environment options not found
How to edit environment variables on Windows 11?
1. Using the Settings app
- Press to open Settings, then go to System, then About ,Then click "Advanced System Settings". WindowsI
- Click Environment Variables, then select the variable you want to edit and click Edit.
- Make your changes and click OK in all three windows to save your changes.
- Restart the Environment Variables window to see the changes.
2. Use the Registry Editor
- Press to open the "Run" dialog box. WindowsR
- Type regedit and click OK to open Registry Editor .
- If you want to change user variables, navigate to this path:
<strong>Computer\HKEY_CURRENT_USER\Environment</strong>
- For system variables, go to Go to the following path:
<strong>Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment</strong>
- If you want to rename the variable name, right click and select "Rename".
- To edit the value data, double-click the variable, change the value data, and click OK.
- Restart your computer to save changes.
3. Use Windows PowerShell
- Use the same steps above to open Windows PowerShell with administrator privileges.
- Type the following command to get the current value of a variable. After replacing VARIABLENAME with the variable name, press: Enter
<strong>$Env: VARIABLENAME</strong>
- Next, to update or edit the value, copy and paste the following command after replacing VARIABLEANME with the variable name and NEWVALUE with the value you want to add, then click: Enter
<strong>$Env: VARIABLENAME = "NEWVALUE"</strong>
- Restart your computer to save changes.
How to get the list of environment variables in Windows?
To get a list of environment variables in Windows 11, you can open a command prompt with administrator rights and type Settings and hit .Enter

In Powershell, with administrator rights to get a list of environment variables, copy and paste the following command and hit: Enter<strong>[System. Environment]::GetEnvironmentVariables()</strong>

Read this guide if you want to print the list of environment variables obtained on PowerShell to apply the same settings on another computer.
Where are Windows environment variables stored?
You can find environment variables in the Registry Editor. System variables are located in Computer\HKEY_LOCAL_MACHINE\System\Current Control Set\Control\Session Manager\Environment, where user variables are located in <strong>Computer\HKEY_CURRENT_USER\Environment</strong>
Setting environment variables on Windows 11 can help you customize system settings; however, you must always be careful when changing system variables.
Remember to double-check variable names and values, and always create a backup of Registry Editor before making changes.
The above is the detailed content of 11 Ways to Set Environment Variables on Windows 3. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



DLNA streaming has been around for a long time and is considered one of the more user-friendly options. Given its compatibility with a variety of devices and systems, you shouldn’t have problems connecting to one. So, let us understand how to enable DLNA in Windows 11. There are two methods, use the built-in Windows DLNA (Digital Living Network Alliance) feature or install a third-party application. While the former works well and provides the best experience, you can try the app with its enhanced feature set. We will list both options. What are the benefits of using DLNA? DLNA allows media streaming across devices on the network, provided the streaming device is compatible with the standard. Once set up on a smart TV or other system, you can

If you are using Hyper-V to run virtual machines on a Windows 11 machine, you may need to change the display resolution of one or both VMs. In this guide, we will introduce simple methods and step-by-step instructions to adjust and optimize display resolution in Hyper-V environment. How to adjust screen resolution in Hyper-V? Before moving on to the detailed steps to change Hyper-V screen resolution on Windows 11, be sure to complete the following checks for smoother operation: Make sure you are logged in with an administrator account. Make sure graphics drivers are updated. Back up important data in the VM. Make sure Hyper-V is enabled. 1. Setting up using Hyper-V First, we will enable enhanced session mode; for this

The message "Your organization has asked you to change your PIN" will appear on the login screen. This happens when the PIN expiration limit is reached on a computer using organization-based account settings, where they have control over personal devices. However, if you set up Windows using a personal account, the error message should ideally not appear. Although this is not always the case. Most users who encounter errors report using their personal accounts. Why does my organization ask me to change my PIN on Windows 11? It's possible that your account is associated with an organization, and your primary approach should be to verify this. Contacting your domain administrator can help! Additionally, misconfigured local policy settings or incorrect registry keys can cause errors. Right now

Since Windows has become the gaming platform of choice, it's even more important to identify its gaming-oriented features. One of them is the ability to calibrate an Xbox One controller on Windows 11. With built-in manual calibration, you can get rid of drift, random movement, or performance issues and effectively align the X, Y, and Z axes. If the available options don't work, you can always use a third-party Xbox One controller calibration tool. Let’s find out! How do I calibrate my Xbox controller on Windows 11? Before proceeding, make sure you connect your controller to your computer and update your Xbox One controller's drivers. While you're at it, also install any available firmware updates. 1. Use Wind

By default, Windows 11 does not display folder sizes in File Explorer, however, you can make certain changes in Explorer settings to make them visible. In this guide, we will discuss some of the easiest ways to display folder sizes so that you can effectively manage disk space on your PC. How to check the size of a folder on Windows 11? 1. Use the folder's Properties window to open a Windows Explorer window by pressing +. WindowsE Go to the folder whose size you want to check, right-click on it and select "Properties" from the context menu. In the folder properties window, go to the "General" tab and find the "Size" section to find out how much space the folder takes up. 2. Enable "

Work on the same setup for too long or share your PC with others. You may have some language packs installed, which often create conflicts. So, it’s time to remove unwanted display languages in Windows 11. Speaking of conflicts, when there are multiple language packs, inadvertently pressing Ctrl+Shift changes the keyboard layout. If not taken care of, this can be a hindrance to the task at hand. So, let’s jump right into the method! How to remove display language from Windows 11? 1. From Settings press + to open the Settings app, go to Time & Language from the navigation pane and click on Language & Region. WindowsI click the ellipsis next to the display language you want to remove and select Remove from the pop-up menu. Click "

Microsoft recently rolled out Windows 11 version 23H2 to all compatible devices, but it didn't appear for many people. This version was earlier only available to users in the Beta and Dev channels. Ever since its public release, users have been eager to try out the latest operating system version. First, Microsoft rolls out updates in stages, with some users receiving them before others. This does not mean that your device is not compatible or will not receive updates. However, if a few days have passed, you should check for problems. Why doesn't Windows1123H2 appear? When the device blocks newer versions of Windows, there are corrupt update components, or the computer fails due to lack of TPM2.0 or Secure Boot

Themes play an integral role for users who wish to modify their Windows experience. It may change the desktop background, animations, lock screen, mouse cursor, sounds, icons, etc. But what if you want to remove themes in Windows 11? It's equally simple and there are options available, both for the current user profile and for the entire system, i.e. all users. Additionally, you can even delete custom themes in Windows 11 if they are no longer used for that purpose. How do I find my current topic? Press + to open the Settings app > Go to Personalization from the navigation pane > Click on Themes > The current theme will be listed on the right. How about WindowsI