How-to: Enumerate User Shell Folders to determine the Profile/Start Menu folder locations.

Roaming Profile Folder Extensions

OS version Local Profile folder %userprofile% Roaming Profile Folder
Windows XP/ 2003 C:\Documents and Settings\username fileshare\username
Windows Vista /7 C:\Users\username fileshare\username.V2
Windows 10 (2015) C:\Users\username fileshare\username.V5
Windows 10 Anniversary Edition (2016) and newer C:\Users\username fileshare\username.V6

Profile Subfolders

The folders for Personal/Profile settings in Windows 10 / 2012 R2 and later:

%USERPROFILE%\AppData\Roaming
%USERPROFILE%\AppData\Local\Microsoft\Windows\INetCookies
%USERPROFILE%\AppData\Local\Microsoft\Windows\History
%USERPROFILE%\AppData\Local
%USERPROFILE%\Documents
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Network Shortcuts
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Printer Shortcuts
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Recent Items
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\SendTo
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Start Menu
%USERPROFILE%\AppData\Roaming\Microsoft\Windows\Templates
%USERPROFILE%\AppData\Local\Microsoft\Windows\INetCache

'All Users' Shell Folders

The folders for All Users settings in Windows 10 / 2012 R2 and later:

%ProgramData%
%ProgramData%\Microsoft\Windows\Start Menu\Programs  *
%ProgramData%\Microsoft\Windows\Start Menu  *
%ProgramData%\Microsoft\Windows\Start Menu\Programs\Startup  *
%ProgramData%\Microsoft\Windows\Templates
%PUBLIC%\Public Desktop %PUBLIC%\Public Documents

PowerShell:

In PowerShell we can retrieve many of these from the list of Environment.SpecialFolders

$myDesktop = [Environment]::GetFolderPath('Desktop')
$myDocs = [environment]::getfolderpath('mydocuments')
$myPrograms = [environment]::getfolderpath('Programs')
$myRecent = [environment]::getfolderpath('Recent')
$mySendTo = [environment]::getfolderpath('SendTo')
$myStartMenu = [environment]::getfolderpath('StartMenu')

$commonDesktop = [environment]::getfolderpath('CommonDesktopDirectory')
$commonDocuments = [environment]::getfolderpath('CommonDocuments')
$commonPrograms = [environment]::getfolderpath('CommonPrograms')
$commonStartMenu = [environment]::getfolderpath('CommonStartMenu')
$commonStartUp = [environment]::getfolderpath('CommonStartup')

You can also Get or Set the Special Folders with a script.

Start Menu Folders*

Your Start Menu: %AppData%\Microsoft\Windows\Start Menu\Programs
Typically: C:\Users\YourUsername\AppData\Microsoft\Windows\Start Menu\Programs

All users Start Menu: %ProgramData%\Microsoft\Windows\Start Menu\Programs
Typically: C:\ProgramData\Microsoft\Windows\Start Menu\Programs

In Windows 10 the Start Menu shortcuts are automatically copied into a database via a background service to improve performance. The database is also used for Cortana Search. Any non-shortcut files in the start menu folders are ignored.
This database is stored under C:\Users\accountname\AppData\Local\TileDataLayer this is proprietary, non user editable and limited to 512 shortcuts.
The entire database can be copied between accounts, along with all the shortcuts, this is a not very flexible 'all or nothing' option.

Making changes via Group Policy or PowerShell

There are definitions for all the above in the registry, however: I implore you to exercise restraint and not rely on this new key. Just use the function SHGetFolderPath, which returns the path to whatever folder you want. Let the "User Shell Folders" key rest in peace. - Raymond Chen (MSFT)

To modify these values, either use Group Policy (User Configuration ➞ Windows Settings ➞ Folder Redirection)
or the PowerShell functions: Get-KnownFolderPath & Set-KnownFolderPath which use SHGetFolderPath.
These use the latest Known FolderID constants (GUIDs) and so work for ALL the Special folders.

The older ShellSpecialFolderConstants do still work but only contain a subset of the Special Folders. Here are a couple of PowerShell and VBScript examples which just echo the values. There are some differences in the names, the old Special Folder constant 'Personal' is now known as 'Documents' (though the registry key is still called 'Personal').

If you must delve into the Registry here are the locations, again the sub keys may vary by locale/language:

Registry locations (REG_EXPAND_SZ)
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

By default these all resolve to subfolders below %USERPROFILE%.

Registry locations for ALL Users (REG_EXPAND_SZ)
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders

On a brand new install of Windows some of the keys may not exist (typically the fonts entry) Registry entries can appear in both the older Shell Folders subkey and the User Shell Folders in both HKLM and HKCU. The entries that appear in User Shell Folders take precedence over those in Shell Folders. Which is maintained for backwards compatibility with Windows NT 4.
The entries that appear in HKCU take precedence over those in HKLM.

Folder Redirection

Although it is possible to redirect any of these folders with Group Policy, not all options are fully supported,
for example redirecting favorites/cookies will result in very slow performance.

Examples

Find the location of the Start Menu folder in CMD:

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%

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

Related commands

How-to: Shell: folder shortcuts to key folders.
How-to: Windows Environment Variables
RoamingProfile.vbs - Cleardown files to improve logon and logoff times.
PowerShell: Get-StartApps - Get the names and IDs of apps installed on the Start Menu.
WshShell.SpecialFolders - VBScript to obtain the path to special Windows folders.
Managing Roaming User Data Deployment Guide - docs.microsoft.com
Q886549 - User Shell Folders.


 
Copyright © 1999-2024 SS64.com
Some rights reserved