6

I have been looking at examples in SO but I think some of the answers are outdated and some I don't seem I can apply.

Basically I want to set my HOMEDRIVE to point to the C drive from the H drive but when I try to change this, it reverts back to H Drive after I open up command window. This maybe due to login but can somebody give me a guide in order to point my HOMEDRIVE correctly?

I cannot see HOMEDRIVE in the environment variables by the way. I tried changing in regedit earlier but no luck.

Thanks

Pristin
  • 147
  • 1
  • 11
  • 1
    `HOMEDRIVE`, like `HOMEPATH`, is a system variable; they (usually) point to the logged-on user's profile directory (like variable `USERPROFILE` does). Changing/overwriting these variables does not affect the location of the user profile, so this appears quite senseless to me... Hence please explain why you want to set `HOMEDRIVE`... – aschipfl Jul 09 '18 at 14:30
  • 1
    How did you "try to change this,"? If this is an organization requirement, it may be that you cannot or should not make this change. – lit Jul 09 '18 at 14:34
  • @aschipfl I have a mounted network drive, which for some reason is set to the HOMEDRIVE, even though my HOME is not on that drive. – Didier A. Nov 11 '18 at 22:05
  • aschipfl and lit - The homedrive and homepath are used as a default home by CMD and programs - in my case rakudo's zef. I have no idea the reasoning for it being different than the userprofile directory, but wanting to change it is totally reasonable. For me its a network drive that has changed its role and I no longer have permissions. *and* its a netowrk drive where a local drive is much better. – Gerard ONeill Dec 17 '20 at 17:10

2 Answers2

1

This issue had been really frustrating me trying to find a solution, but I have found what I think is the definitive answer. The computer I usually use has Windows 10 Pro installed and setting a home folder for a user is a trivial task using lusrmgr.msc. However, I also sometimes use another computer that has Windows 10 Home installed, and you can't run lusrmgr.msc on that edition (trying to run it displays an error message saying 'This snapin may not be used with this edition of Windows 10').

Various methods for setting a home folder are described at https://support.microsoft.com/en-us/help/816313/how-to-assign-a-home-folder-to-a-user. The answer turned out to be to open a command prompt with administrator privileges and then use the command line method described on that webpage.

First, run 'net user' to get a list of the usernames known on the local system.

Then, run 'net user USERNAME /homedir:PATH' where USERNAME is the name of the user you are trying to change and PATH is the drive letter and full path to the desired home folder, which must already exist.

For example, to set the home folder for user Fred to H:\Users\Fred type:

net user Fred /homedir:H:\Users\Fred

After Fred next logs in, the HOMEDRIVE volatile environment variable will be set to H: and HOMEPATH will be set to \Users\Fred

Richard
  • 11
  • 2
1

In case someone else has this issue for me it was on a work computer and my H drive was a network drive and it was set as HOMEDRIVE from an admin level. I was needing to use Kubernetes and it was not mapping to the C drive. I just disconnected my H: drive when I needed to work with kubernetes.

mjwrazor
  • 1,376
  • 1
  • 17
  • 31
  • windows magic! I suppose this allows you to login to anyone's computer and get stuff from the h drive. However documents and downloads and photos are all on the c drive... – Gerard ONeill Dec 17 '20 at 17:33