How to Set Environment Variables in Windows for User Login
In Windows, environment variables can be set for specific user logins or for the entire system. As you have mentioned, you do not have the privilege to set system variables, so this article will focus on setting environment variables for user logins.
There are two ways to set environment variables in Windows:
1. Using the Command Prompt (set)
The set command modifies the environment variables for the current shell. The changes are temporary and apply only to the current shell session. To set environment variables using set, open a Command Prompt window and run the following commands:
set ADDR=127.0.0.1 set TOKEN=ABCD1234
2. Using the setx Command
The setx command modifies environment variables permanently for a specific user. The changes are applied to all future shell sessions and will persist until they are changed. To set environment variables using setx, run the following commands:
setx ADDR "127.0.0.1" setx TOKEN "ABCD1234"
Verifying the Changes
After setting environment variables using either method, you can verify the changes using the set command:
set
The output should include the environment variables you set. If the environment variables are not set properly, check if you have the required privileges or if there are any syntax errors in the commands you used.
The above is the detailed content of How Do I Set Environment Variables in Windows for User Logins?. For more information, please follow other related articles on the PHP Chinese website!