mpr
mpr

Reputation: 3906

Why setx command does not set an user variable?

I want to add an user variable using setx. I tried:

setx LOL abcd

> SUCCESS: Specified value was saved

echo %LOL%

> %LOL%

Why it does not set an user variable? I expected:

echo %LOL%

> abcd 

Upvotes: 4

Views: 2692

Answers (1)

Richard
Richard

Reputation: 109015

Why setx command does not set an user variable?

Because that is the way it works.

setx will change the environment variable you specify for future sessions. Use set to set for the current and new child processes.

Upvotes: 5

Related Questions