Share via


Changing %username% variable

Question

Friday, January 27, 2017 12:47 AM | 1 vote

Hello.

I changed a users local username at a request due to a bug with Java not being able to handle "Admin!" as a username. The username was changed to "Admin" and the folder was renamed (registry was changed to reflect this new path). However, despite renaming the user on Control Panel and the above, Windows still spits back %username% with "Admin!". Is there any way to change this?

Thanks,

Chris.

All replies (2)

Friday, January 27, 2017 12:57 AM âś…Answered | 4 votes

Hello all,

I've resolved this issue. For those experiencing this issue, doing the following will ensure it is fixed.

Launch Command Prompt -> echo %username% and ensure it's the incorrect/old username. 

In command prompt or Windows Run Dialogue, access netplwiz and locate the account. Click "Properties" and change the Username portion to the correct username.

Click Apply/OK and log out and back in. Windows will correct the %username%. This can be verified by repeating the first step of checking command prompt.

Thanks everyone!

Chris.


Monday, January 30, 2017 4:31 PM

Thanks for your sharing on this issue, this could be definitely helpful for other community members who has similare issue as yours. 

Please remember to mark the replies as answers if they help.
If you have feedback for TechNet Subscriber Support, contact [email protected].