问题
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
回答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
回答2:
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.
来源:https://stackoverflow.com/questions/51247119/how-to-set-homedrive-from-h-drive-to-c-drive