Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Windows 10 - Username with whitespace and PATH [closed]

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.

like image 424
Miha Šušteršič Avatar asked Feb 03 '16 11:02

Miha Šušteršič


People also ask

How do I remove a space from a username in Windows 10?

First change your username to remove the white space. Then create a new Administrator account, log out an log in using that. Rename the user folder and go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList<User SID>\ registry key and rename ProfileImagePath to the new user folder path.

Can you have a space in a Windows username?

That said, even Microsoft recommends against using spaces in Windows usernames, because of some of the above issues. From this MSDN document: Logon names can contain all other special characters, including spaces, periods, dashes, and underscores. But it's generally not a good idea to use spaces in account names.


2 Answers

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._

like image 154
t_jenesaisquoi Avatar answered Oct 11 '22 17:10

t_jenesaisquoi


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 
like image 33
trysten Avatar answered Oct 11 '22 16:10

trysten