Windows 10 - Username with whitespace and PATH [closed]

吃可爱长大的小学妹 提交于 2021-02-05 18:50:08

问题


Upon installing Windows 10 I created my admin user as Miha Šušteršič. Now when I install programs that need to modify the environment variable PATH, most of them don't get added. For instance this happens with MongoDB and Git, but npm got added normally.

I think this is an issue with the whitespace in the path to the variables. I tried renaming my username to M.Sustersic, but the system folder Users\Miha Šušteršič\ did not get updated.

Is there a way for me to change this folder name automatically (so the rest of the app dependencies on \Users\Miha Šušteršič\AppData don't get bugged) or do I need to reinstall windows?

Is there something else I am missing here? I tried adding the dependencies on my own, but nothing worked so far.


回答1:


See this KB article to change the name of the User Profile directory.

After you do this, you may want to make a link just in case any of your apps keep local path configuration.

cd C:\Users
mklink /D "Miha Šušteršič" M.Sustersic



回答2:


You can actually change the folder name. It's a bit tedious but it's worth it. Make sure you know of the edition of your Windows 10 you're using first - Professional, Enterprise or Home - before carrying out these steps, cos of step 5:

  1. Right click on Windows Start Menu option and click Command Prompt (Admin)

(If you can't find Command Prompt (Admin) when you right-click on the Start Menu or search for it, you can simply go to C:/Users/Default/AppData/Local/Microsoft/Windows/WinX/Group3 on your pc. There, you'll find two shortcuts both named "Command Prompt"; one is for Command Prompt, and the other is for Command Prompt (Admin).Try out both shortcuts to know which is which, and then click on the one for Command Prompt (Admin))

  1. In the Command Prompt (Admin), create a new/temporary admin account by entering this command: net user Administrator /active:yes (Notice the space between Administrator and /) and close the cmd

  2. Next, click on the start menu and sign out of your current admin account (four icons above the shut down button)

  3. Sign in with the new Administrator account you just created

  4. (Skip this step only if you use the Windows Home Edition) Right click on the Start Menu and click Computer Management and open Local Users and Groups > Users. Right-click on the username you wish to change and select Rename and close the window.

  5. Open Local Disk (C) > Users and right-click and rename the corresponding folder with the name you wish, just as in Step 5, and close the window.

  6. Next, search for regedit in the search box and click on it. Now, inside the regedit (i.e. Registry Editor), go to HKEY_LOCAL_MACHINE > SOFTWARE > Microsoft > Windows NT > Current Version > Profile List.

In the list of identifiers under Profile List, find the ProfileImagePath that corresponds to the account name you wish to change. Yours should look something like this:

ProfileImagePath REG_EXPAND_SZ c:\Users\Miha Šušteršič.

Double click on the value and rename it to what you want.

  1. Still in the regedit, scroll up to the top of the window and make sure the highlight is on Computer, then click Edit in the menu options just above it; then click Find; then enter C:\Users\<your old username>. In your case, that would be:

C:\Users\Miha Šušteršič

And search.

  1. If the search brings out any result (i.e. any folder bearing your old account user name,) click on it and rename it, and then go back to Edit in the menu option and this time, click Find Next or f3. Keep on "Finding Next" this until there are no files are left to rename, then close regedit.

  2. Finally, sign out of your Administrator account and sign in with your now-renamed account, and then, go on to disable the Administrator account you just signed out from. You do this by going to Command Prompt (Admin) and this time, you enter the command:

net user Administrator /active:no

(Once again, notice the space between Administrator and /)

...and close the command.

And that's it! Long and tedious, but it works. You can check also out this video to have a better understanding of everything I just described.

_Note: Make sure to follow every step to the letter so you don't run into more serious problems.

If you run into any issues renaming at Step 6, simply shut down your computer and restart and try again.

Also, certain files may/will not allow for renaming. It's alright; just leave them as they are and "Find Next" until there's no more file to rename._




回答3:


The easiest way is:

Search for your username in the Users folder and then right click. You will get a rename option. Change it to have no white space characters and it will change permanently.



来源:https://stackoverflow.com/questions/35175814/windows-10-username-with-whitespace-and-path

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