3

In Windows, is there a command (preferably) or registry key that contains all of the explorer shell locations in Windows (Computer, UsersFiles, etc) without external programs?

5

Most, if not all, of the names of the varous HKLM\...\FolderDescriptions entries work with the Shell: command. You can list them with PowerShell:

$FD = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions'
(gp (gci $FD).PSPath).Name
PS C:\...\keith>$FD = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions'
>> (gp (gci $FD).PSPath).Name
>>
AccountPictures
Roaming Tiles
Common Programs
PublicAccountPictures
GameTasks
UserProfiles
MyComputerFolder
SearchHistoryFolder
Local Pictures
SyncSetupFolder
DpapiKeys
Retail Demo
Favorites
My Video
SearchHomeFolder
RecordedTVLibrary
System
Libraries
ThisDeviceFolder
AppsFolder
MusicLibrary
CommonVideo
OneDriveDocuments
SyncResultsFolder
LocalizedResourcesDir
Cookies
CameraRollLibrary
Original Images
Recorded Calls
3D Objects
CommonMusic
OneDrivePictures
My Pictures
Cache
Local Videos
Downloads
SavedPictures
CommonDownloads
AppData
SyncCenterFolder
PublicLibraries
VideosLibrary
My Music
ConflictFolder
SavedGames
InternetFolder
HomeGroupFolder
Quick Launch
SystemCertificates
AppDataProgramData
Contacts
UserProgramFiles
Device Metadata Store
Profile
Start Menu
Common AppData
ProgramFilesCommonX64
PhotoAlbums
ProgramFilesX64
ConnectionsFolder
Administrative Tools
ThisPCDesktopFolder
OneDriveCameraRoll
PrintersFolder
AppMods
DocumentsLibrary
AppDataDocuments
ProgramFilesX86
AppDataFavorites
Searches
Local Downloads
SearchTemplatesFolder
Common Startup
ControlPanelFolder
SendTo
ResourceDir
ProgramFiles
CredentialManager
PrintHood
MAPIFolder
HomeGroupCurrentUserFolder
User Pinned
CD Burning
Local Music
UsersLibrariesFolder
AppUpdatesFolder
Application Shortcuts
Common Start Menu
Common Start Menu Places
LocalAppDataLow
OneDrive
Templates
Programs
PicturesLibrary
Roamed Tile Images
Camera Roll
Recent
AppDataDesktop
Desktop
CommonPictures
RecycleBinFolder
Screenshots
CryptoKeys
Common Templates
Startup
ImplicitAppShortcuts
UserProgramFilesCommon
Links
OEM Links
OneDriveMusic
Common Desktop
NetHood
Ringtones
Common Administrative Tools
NetworkPlacesFolder
SystemX86
History
Development Files
AddNewProgramsFolder
Playlists
ProgramFilesCommonX86
PublicGameTasks
ChangeRemoveProgramsFolder
Public
SavedPicturesLibrary
CommonRingtones
Common Documents
Captures
CSCFolder
Local AppData
Windows
UsersFilesFolder
Local Documents
ProgramFilesCommon
Fonts
Personal

Then, there are some CLSIDs that work with the Shell: command in the format Shell:::{<GUID>}. Any subkey of HKCR\CLSID that has a ShellFolder subkey is a likely suspect, So we can find those:

New-PSDrive -Name HKCR -PSProvider Registry -Root HKEY_CLASSES_ROOT | out-null
gci 'HKCR:\CLSID' | ? { $_.GetSubkeyNames() -contains 'ShellFolder' } | select PSChildName, @{N = 'Default'; E = {(gp $_.PSPath).'(Default)'}}
PS C:\...\keith>gci 'HKCR:\CLSID' | ? { $_.GetSubkeyNames() -contains 'ShellFolder' } | select PSChildName, @{N = 'Default'; E = {(gp $_.PSPath).'(Default)'}}

PSChildName                            Default
-----------                            -------
{00020D75-0000-0000-C000-000000000046}
{00021400-0000-0000-C000-000000000046} Desktop
{018D5C66-4533-4307-9B53-224DE2ED1FE6} OneDrive
{025A5937-A6BE-4686-A844-36FE4BEC8B6D} Power Options
{031E4825-7B94-4dc3-B131-E946B44C8DD5} UsersLibraries
{04731B67-D933-450a-90E6-4ACD2E9408FE} CLSID_SearchFolder
{05d7b0f4-2121-4eff-bf6b-ed3f69b894d9} Taskbar
{088e3905-0323-4b02-9826-5d99428e115f}
{0AFACED1-E828-11D1-9187-B532F1E9575D} Folder Shortcut
{0c39a5cf-1a7a-40c8-ba74-8900e6df5fcd}
{0CD7A5C0-9F37-11CE-AE65-08002B2E1262} Cabinet Shell Folder
{0DB7E03F-FC29-4DC6-9020-FF41B59E513A}
{0DF44EAA-FF21-4412-828E-260A8728E7F1} Taskbar
{0E5AAE11-A475-4c5b-AB00-C66DE400274E} Shell File System Folder
{11016101-E366-4D22-BC06-4ADA335C892B} IE History and Feeds Shell Data Source for Windows Search
{1206F5F1-0569-412C-8FEC-3204630DFB70} Credential Manager
{15eae92e-f17a-4431-9f28-805e482dafd4} Install New Programs
{17cd9488-1228-4b2f-88ce-4298e93e0966} Set User Defaults
{1bef2128-2f96-4500-ba7c-098dc0049cb2} CLSID_DBFolderBoth
{1CF1260C-4DD0-4ebb-811F-33C572699FDE}
{1D2680C9-0E2A-469d-B787-065558BC7D43} Fusion Cache
{1f3427c8-5c10-4210-aa03-2ee45287d668} User Pinned
{1FA9085F-25A2-489B-85D4-86326EEDCD87} Manage Wireless Networks
{208D2C60-3AEA-1069-A2D7-08002B30309D} Network
{20D04FE0-3AEA-1069-A2D8-08002B30309D} This PC
{21EC2020-3AEA-1069-A2DD-08002B30309D} All Control Panel Items
{2227A280-3AEA-1069-A2DE-08002B30309D} Printers
{22877a6d-37a1-461a-91b0-dbda5aaebc99} Recent Places Folder
...

But many of these are items that are children of another, like the Control Panel items. Here's how to get the list of those:

$Shell = New-Object -ComObject shell.application
$DT = $Shell.Namespace(0)

Function Unfold ($oFolder) {
$oFolder.Items() | ?{ ($_.IsFolder -eq $True) -and ($_.Name -notLike 'Fonts') } | ForEach{
UnFold $_.GetFolder
}
$_.GetFolder.Items() | select Name, Path
}

$DT.Items() | ?{($_.IsFolder -eq $True) -and
        ($_.Name -match 'Control Panel')} | % {
            Unfold $_.GetFolder
} | select name, path -unique | Sort Path | Out-Gridview

GridView

1

The best one I have seen is Shell View Menu (64-bit and 32-bit) from Nirsoft.net. There are a LOT of entries so be ready. But this software is excellent for this.

I use a number of Nirsoft tools because they are good.

Here is a screen shot of Shell View. Not shown is the CLSID field, but what you want is here

enter image description here

2
  • I was thinking more along the lines of an official command or registry key. How does Shell View Menu work? – Anonymous Feb 26 '20 at 23:05
  • I added a screen shot so you can see what it does. I have not see a command line for this that would put out an organized list. – John Feb 26 '20 at 23:10
0

What you are looking for is the IKnownFolder interface (part of Shell32.dll).
This provides all the tools to obtain information about these special folders.
The Windows SDK has several examples for how to use this.

There are subtle differences in the way the various versions of Windows (since Vista) deal with this information, but the IKnownFolders interface is supported on all Windows versions since Vista and gives you a consistent interface so you don't need to deal with the differences yourself.

1
  • Which function lists all of the shell locations? I've looked over the documentation and they seem to be useful for retrieving information about a known shell folder. – Anonymous Feb 26 '20 at 23:25
0
@For /f "tokens=1* delims=" %%A in ('reg query HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderDescriptions /f name /v name /s ^| findstr /c:"Name" ^| Sort') Do @Echo %%A
pause

Will list all folders you can open with the shell: command in Start - Run.

EG

Shell:User Pinned

@For /f "tokens=1* delims=" %%A in ('reg query HKCR /f "URL:*" /s /d ^| findstr /c:"URL:" ^| findstr /v /c:"URL: " ^| Sort') Do @Echo %%A %%B
pause

Will list Windows' Store Apps (plus internet protocols) and how to start them.

It takes a a minute or so to search the registry and as it sorts it so cannot show progress.

To start Paint 3D

ms-paint://

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.