59

I have got a laptop which is configured to have the user profile in a network drive. This is causing me a lot of headaches since the connectivity to my company is very slow. I want to relocate the profile of my user into a local directory. How do I do that?

Those are the settings at the moment:

C:\>set HOME
HOMEDRIVE=P:
HOMEPATH=\
HOMESHARE=\\SOMESERVER\_myuser$

The drive P is a network drive mapped to HOMESHARE.

I can't find where windows is setting those environment variables, not even in the registry.

The laptop is running Windows XP.

fixer1234
  • 28,064
Luigi
  • 667

7 Answers7

31

I had a similar problem, which caused problems with msysgit. Here is the solution I used, and it definitely worked for me. This answer is similar to this and that SO post.

  1. If you are on Windows 7, you can skip this step. If you are on Windows XP, download and install Windows XP Service Pack 2 Support Tools which contains SETX, a utility, described on SS64 and technet, that lets you set permanent system and user variables. You must have administrative rights to set global system variables. The basic usage is SETX <variable> "<value>" [-m].

  2. Add the following script to your startup folder - W7: "C:\Users\<username>\Start Menu\Programs\Startup" and XP: "C:\Documents and Settings\<username>\Start Menu\Programs\Startup".

     SETX HOMEDRIVE %SYSTEMDRIVE% -m
     SETX HOMEPATH "\Documents and Settings\%USERNAME%" -m
     SETX HOMESHARE "\\<server>\<share>" -m
     SET HOME=%SYSTEMDRIVE%\Documents and Settings\%USERNAME%
     SETX HOME "%HOME%"
     SET TEMP=%HOME%\Local Settings\Temp
     SETX TEMP "%TEMP%"
     SETX TMP "%TEMP%"
    

Note: SETX variables are permanent, but are not available until after the script runs, so use SET to create temporary variables in your script. Also uses double quotes around the value you want to set your variable to in case it has spaces, but this is not necessary for SET. Machine variables are set with the -m option; user variable is the default. Windows 7 has many more options and uses / instead of -.

AJM
  • 500
13

Problem occurs with TortoiseGit when working out of office, where network drive is not connected.

Changing HOME, HOMEPATH does not help!!

Solution:

mkdir c:\home
net use g: /delete
subst g: c:\home

Where g: is network drive.

 

Toto
  • 19,304
12

I know I'm late to this thread, but I have got the same problem when my IT department changed group policies and my HOMEDRIVE has became M: instead for C: and HOMEPATH just "\" insted for "\Users \ [username]". I looked in Git code and found that it uses HOMEDRIVE/HOMEPATH combination only if HOME is not defined.

So I just defined HOME (which was fortunately not in GP) as "C:\Users \ [username]" and Git has found .gitconfig again.

174140
  • 134
12

There's a good chance that whatever you change will just get put back the next time you attach to the domain (via Group Policies or alike).

Have you considered asking your company's IT folks if they can change that for you?

Perhaps create a local user on the laptop for use when outside of the domain, that way you're not waiting for these slow-link shortcuts, nor are you trying to circumvent the domain user settings as laid out by the company.

9

I have a similar problem in my corporate environment, and developed a variety of hacks and work-arounds. With my current setup the following values are forced by the domain:

set HOME
HOMEDRIVE=G:
HOMEPATH=\
HOMESHARE=\\Server\Users\username

But with my workaround, the resulting mappings are:

HOMEDRIVE => G: => \\Server\Users\username => C:\Users\username
HOMESHARE       => \\Server\Users\username => C:\Users\username

While other server paths / drive mappings go to the remote server:

O: => \\Server\Example => \\Real_Server\Example
      \\Server\Example => \\Real_Server\Example

These have only been tested in Windows 7, but I would imagine that they will also work in Windows XP if you have the mklink tool.

Terrance
  • 1,256
4

They're in the advanced system properties. On Vista/Win 7:

  1. Right-click "My Computer"
  2. Select "Properties"
  3. Select "Advanced System Settings" (link on left side of window)
  4. Select "Advanced" (tab)
  5. Select "Environment Variables" (button)
-1

You can modify in the registry (ouch!) but it may be superseded by group policy. The best answer is to set a %HOME% before launching git, msysgit, git-bash, gitkraken or whatever.

Janusz has the right way to do it: thru windows environment variables (see Marc B for the mouse path)