Override Windows environment variable value?

帅比萌擦擦* 提交于 2021-01-28 12:37:24

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!