How to set home directory in Win10

I currently do not have a home directory on my laptop, and all users are under C:\Users. I want a folder, C:\Users\username, to become C:\home\username. On Linux I know this is mkhomedir_helper, but I am unfamiliar with how to implement this on Windows 10.


Solution 1:

Find your SID

Run the following command from the command prompt:

wmic useraccount where name="USER" get sid

Remember to replace USER with your username. Write this down as you will need it later.

(credit)

Move your User Profile

Using an administrator account other than the one you want to move, copy the folder C:\Users\Username to C:\home\username.

Open Regedit to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList

In the left pane under the Profilelist key, select the key that matches the SID your got before. In the right pane, right click on ProfileImagePath, and click on Modify. Enter the full path to where you copied your User Profile to (i.e. C:\home\username.

(credit)

Solution 2:

(update: this might only work on Windows 10 Pro)

Plonis answer is good but instead of going to the registry:

  • start menu > type "users" > select "Edit local users or groups" (or lusrmgr.msc)
  • double click Users
  • double click the user you want to change
  • Profile tab > Home folder > Local path > enter the new path

Solution 3:

In my case the $HOME environment variable didn't exist, so I created one.

  1. From the Start menu, enter env to display the Environment Variables window.
  2. Enter a new $HOME variable for my account:

Variable Name: HOME

Value: C:\Users\ThinkW541_User

Then when I call up PowerShell Administrator (not the Windows CMD window that this does not work in) I check it by entering:

$HOME

I get: C:\Users\ThinkW541_User

From there I can use the $HOME variable in paths. For example: wsl.exe --import Fedora-33 c:\distros\Fedora-33 $HOME\Downloads\fedora-33.tar