如何获取 Windows 中所有 shell 位置的列表

如何获取 Windows 中所有 shell 位置的列表

在 Windows 中,是否有一个命令(最好)或注册表项包含 Windows 中所有资源管理器 shell 位置(ComputerUsersFiles等)而无需外部程序?

答案1

大多数(如果不是全部的话)各种条目的名称都HKLM\...\FolderDescriptions适用于该Shell:命令。您可以使用电源外壳

$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

然后,有一些 CLSID 可以使用Shell:以下格式的命令Shell:::{<GUID>}。任何具有ShellFolder子项的 HKCR\CLSID 子项都可能是嫌疑犯,因此我们可以找到那些:

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
...

但其中许多都是另一个项目的子项目,例如控制面板项目。获取这些项目的列表的方法如下:

$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

网格视图

答案2

我见过的最好的是 Shell View Menu(64 位和 32 位)Nirsoft.net。条目很多,所以要做好准备。但这款软件非常适合。

我使用了许多 Nirsoft 工具,因为它们很好用。

这是 Shell View 的屏幕截图。未显示 CLSID 字段,但您想要的内容在这里

在此处输入图片描述

答案3

@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

shell:将列出可以使用以下命令打开的所有文件夹开始运行

例如

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

将列出 Windows 商店应用程序(以及互联网协议)以及如何启动它们。

搜索注册表需要一分钟左右的时间,并且由于对其进行排序,因此无法显示进度。

启动 Paint 3D

ms-paint://

答案4

你正在寻找的是已知文件夹接口(Shell32.dll 的一部分)。
这提供了获取有关这些特殊文件夹的信息的所有工具。Windows
SDK 有几个如何使用它的示例。

Windows 的各个版本(自 Vista 以来)处理这些信息的方式有细微的差别,但自 Vista 以来的所有 Windows 版本都支持 IKnownFolders 接口,并为您提供了一致的接口,因此您不需要自己处理这些差异。

相关内容