How Do I Set Environment Variables in Windows for User Logins?

Mary-Kate Olsen
Release: 2024-11-19 20:08:03
Original
699 people have browsed it

How Do I Set Environment Variables in Windows for User Logins?

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
Copy after login

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"
Copy after login

Verifying the Changes

After setting environment variables using either method, you can verify the changes using the set command:

set
Copy after login

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!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template