Windows Registry Hacks/HKEY LOCAL MACHINE

From Wikibooks, open books for an open world
Jump to: navigation, search

Changing program installation directories[edit]

With Cygwin you can list the registry entries concerning installation directories with one of these commands:

regtool list -v /HKEY_LOCAL_MACHINE/SOFTWARE/Wow6432Node/Microsoft/Windows/CurrentVersion | grep Program

or

regtool list -v /HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion | grep Program

The output should be someting like:

SM_ConfigureProgramsName (REG_SZ) = "Set Program Access and Defaults"
CommonFilesDir (REG_SZ) = "C:\Program Files (x86)\Common Files"
CommonFilesDir (x86) (REG_SZ) = "C:\Program Files (x86)\Common Files"
CommonW6432Dir (REG_SZ) = "C:\Program Files\Common Files"
ProgramFilesDir (REG_SZ) = "C:\Program Files (x86)"
ProgramFilesDir (x86) (REG_SZ) = "C:\Program Files (x86)"
ProgramFilesPath (REG_EXPAND_SZ) = "%ProgramFiles(x86)%"
ProgramW6432Dir (REG_SZ) = "C:\Program Files"

Changing the user home directory[edit]

The registry key that has to be changed is

HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CurrentVersion\ProfileList\ProfilesDirectory

The default value is %SystemDrive%\Users and can be changed to a specific path (without %SystemDrive%), like for instance U:\usr\unix\cygwin\home.

To move the remaining content of C:\users you have to open "Start -> Control Panel -> Folder Options" and select the "Show Hidden files, folders, and drives" option in the "View" tab. This will make a "default" subdirectory visible in the C:\users directory. Now most of the content of C:\users can be copied to the new destination (but not all the files of the active user).

For the "default" and "public" subdirectories the following keys need to be set to point to the new location:

HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CurrentVersion\ProfileList\Default
HKEY_LOCAL_MACHINE\SOFTWARE\MICROSOFT\WINDOWS NT\CurrentVersion\ProfileList\Public

On Windows 7 (and probably other versions) the procedure does only affect accounts created after changing the ProfilesDirectory setting. For all other accounts the location of the Desktop, Documents and other standardized directories have to be changed manually, which is, of course, also possible without changing the registry. These locations are: Contacts, Desktop, Documents, Downloads, Favorites, Links, Music, Pictures, Saved Games, Searches, Videos and Virtual Machines.

For accounts created earlier one should also use %windir%\system32\compmgmt.msc (Computer Management) to change the location of the home folder local path under the "Profile" tab. This will, however, not automatically change the location of Desktop, Documents and other standardized directories.