User Shell Folders - Profile, Start Menu folder...

In Windows 7/2008 the main User Profile folder (%USERPROFILE%) has moved from C:\Documents and Settings\ to C:\Users\ and many profile folders have also changed name or location:

 Windows XP/2003                Windows 7/2008

%USERPROFILE%\Application Data %USERPROFILE%\AppData\Roaming
%USERPROFILE%\Cookies          %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Cookies
%USERPROFILE%\History          %USERPROFILE%\AppData\Local\Microsoft\Windows\History
%USERPROFILE%\Local Settings   %USERPROFILE%\AppData\Local
%USERPROFILE%\My Documents     %USERPROFILE%\Documents
%USERPROFILE%\NetHood          %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Network Shortcuts
%USERPROFILE%\PrintHood        %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
%USERPROFILE%\Recent           %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Recent
%USERPROFILE%\SendTo           %USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo
%USERPROFILE%\Start Menu       %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu
%USERPROFILE%\Templates        %USERPROFILE%\AppData\Roaming\Microsoft\Windows\Templates
%USERPROFILE%\Temporary Internet Files %USERPROFILE%\AppData\Local\Microsoft\Windows\Temporary Internet Files

The values above can be found in the registry (as REG_EXPAND_SZ values)
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

The following HKCU registry subkeys are common to Windows XP/2003/7/2008 :

AppData, Cache, Cookies, Desktop, Favorites, History, LocalAppData, My Pictures, NetHood, Personal, PrintHood, Programs, Recent, SendTo, Start Menu, Startup, Templates.

In summary - the registry locations have stayed the same, but the files and folders are in different places. Some applications read the registry to determine where to save things, others will have hard coded the file paths.

To provide backwards compatibility, in Windows 7/2008 the old locations under C:\Documents and Settings contain junction points (hidden, protected operating system files) which point to the new user-accessible folders.

'All Users' Shell Folders

The folders for All Users settings have also moved:

 Windows XP/2003                      Windows 7/2008

%ALLUSERSPROFILE%\Application Data    %ProgramData%
%ALLUSERSPROFILE%\Desktop             %PUBLIC%\Desktop
%ALLUSERSPROFILE%\Documents           %PUBLIC%\Documents
%ALLUSERSPROFILE%\Start Menu\Programs %ProgramData%\Microsoft\Windows\Start Menu\Programs
%ALLUSERSPROFILE%\Start menu          %ProgramData%\Microsoft\Windows\Start Menu
%ALLUSERSPROFILE%\Start Menu\Programs\Startup  %ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup
%ALLUSERSPROFILE%\Templates           %ProgramData%\Microsoft\Windows\Templates

The values above can be found in the registry (as REG_EXPAND_SZ values)
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders
The entries in this subkey can appear in both the Shell Folders subkey and the User Shell Folders and in both HKLM and HKCU. The entries that appear in user User Shell Folders take precedence over those in Shell Folders. The entries that appear in HKCU take precedence over those in HKLM

The following HKLM registry subkeys are common to Windows XP/2003/7/2008 :

Common AppData, Common Desktop, Common Documents, Common Programs, Common Start Menu, Common Startup, Common templates

Examples

Find the location of the Start Menu folder:

For /f "tokens=3*" %%G in ('REG QUERY "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v "Start Menu" ^|Find "REG_"') do Call Set _startmenu=%%H

Echo %_startmenu%

PowerShell function to open the Start menu:

function Open-StartMenu {
$drive = dir env:SystemDrive
$w7path = $drive.value + "\ProgramData\Microsoft\Windows\Start Menu"
$xppath = $drive.value + "\Documents and Settings\All Users\Start Menu"
if (test-path $w7path)
 {explorer $w7path}
elseif (test-path $xppath) {explorer $xppath}
}

“There are no shortcuts to any place worth going” - Beverly Sills

Related:

Shell: folder - Shortcuts to key folders.
Windows Environment Variables
RoamingProfile.vbs - Cleardown files to improve logon and logoff times.
Managing Roaming User Data Deployment Guide - TechNet (html and .doc)
Q886549 - User Shell Folders


© Copyright SS64.com 1999-2015
Some rights reserved