Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ronaldokun/653b877f5162d2a2716d38ebfdb40ad9 to your computer and use it in GitHub Desktop.
Save ronaldokun/653b877f5162d2a2716d38ebfdb40ad9 to your computer and use it in GitHub Desktop.
Change HOMEDRIVE HOMEPATH and HOMESHARE in a Windows with Group Policy
c:\> set HOME
HOME=C:\Users\rsilva
HOMEDRIVE=U:
HOMEPATH=\
HOMESHARE=\\WIFSSP01\EstruturaFS\usu\rsilva
The Drive U: is a network drive defined by the Group Policy in the organization. It's very slow.
1. I had a similar problem, which caused problems with msysgit. Here is the solution I used, and it definately worked for me. This answer is similar to this and that SO post.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 -.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment