问题
I want to permanently change the value of the "Username" variable of Windows to fix a problem of my Windows 8 with the user profile folder name.
I've tried to set a new environment variable using SETX tool like this:
SETX /M Username "value"
...The new variable is generated, I can see it in the registry with the other variables, but is not overrided 'cause if I try to display the value of Username variable the it displays the old value.
Is it possibly to do what I want?
回答1:
CMD
reads the system environment variables when it starts. To re-read those variables you need to restart CMD
.
As for the variable %USERNAME%
: that variable is automatically populated with the username of the currently logged-in user. You'd have to change the username to change the value of that variable. Don't tamper with it.
来源:https://stackoverflow.com/questions/17777046/override-windows-environment-variable-value