答案1
编辑 8/18/2022
使用修改后的代码重新审视这个答案:
- 添加规范名称作为
(Default)
每个键的值,以使用户进一步修改更容易。 - 清除现有的已保存的 SearchResults 视图以确保应用新的默认值。
- 为可能需要除 之外的默认值的用户添加
IconSize
和值。文章末尾列出了值列表。LogicalViewMode
Details
您需要一些默认情况下不存在的注册表项来设置各种搜索结果模板细节视图。此修改可应用于整个计算机或每个用户,并且可以通过合并来创建注册表项.reg文件或kby电源外壳脚本。必须从管理 PowerShell 控制台运行机器范围的 PowerShell 编辑。可以使用任何文本编辑器保存 .reg 文件,然后右键单击并合并。
计算机范围的 PowerShell(管理员)
$FldrTypes = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes'
$hkcuBags = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags'
$hklmBags = 'HKLM:\SOFTWARE\Microsoft\Windows\Shell\Bags'
gci $FldrTypes | gp | ? CanonicalName -match '\.SearchResults$' | %{
New-Item ('{0}\AllFolders\Shell\{1}' -f $hklmBags , $_.PSChildName) -Force |
Set-ItemProperty -Name '(Default)' -Value (gp $_.PSPath).CanonicalName -PassThru |
New-ItemProperty -Name Mode -value 4 |
New-ItemProperty -Name IconSize -value 16 |
New-ItemProperty -Name LogicalViewMode -value 1 | Get-Item ### Dislpays key after creation
$hkcuBags | gci | ? PSChildName -match '\d+' | gci -s | ? PSChildName -eq $_.PSChildName | Remove-Item
}
每用户 PowerShell
$FldrTypes = 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes'
$hkcuBags = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags'
gci $FldrTypes | gp | ? CanonicalName -match '\.SearchResults$' | %{
New-Item ('{0}\AllFolders\Shell\{1}' -f $hkcuBags , $_.PSChildName) -Force |
Set-ItemProperty -Name '(Default)' -Value (gp $_.PSPath).CanonicalName -PassThru |
New-ItemProperty -Name Mode -value 4 |
New-ItemProperty -Name IconSize -value 16 |
New-ItemProperty -Name LogicalViewMode -value 1 | Get-Item ### Dislpays key after creation
$hkcuBags | gci | ? PSChildName -match '\d+' | gci -s | ? PSChildName -eq $_.PSChildName | Remove-Item
}
计算机范围的 .reg 文件
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{20338b7b-531c-4aad-8011-f5b3db2123ec}]
@="Contacts.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{36011842-dccc-40fe-aa3d-6177ea401788}]
@="Documents.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{3D1D4EA2-1D8C-418a-BFF8-F18370157B55}]
@="OtherUsers.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{4dcafe13-e6a7-4c28-be02-ca8c2126280d}]
@="Pictures.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{503a4e73-1734-441a-8eab-01b3f3861156}]
@="Communications.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{59BD6DD1-5CEC-4d7e-9AD2-ECC64154418D}]
@="UsersLibraries.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{71689ac1-cc88-45d0-8a22-2943c3e7dfb3}]
@="Music.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{7fde1a1e-8b31-49a5-93b8-6be14cfa4943}]
@="Generic.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{921C636D-9FC8-40d7-899E-0845DCD03010}]
@="PublishedItems.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{e053a11a-dced-4515-8c4e-d51ba917517b}]
@="UserFiles.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{ea25fbd7-3bf7-409e-b97f-3352240903f4}]
@="Videos.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
每个用户的 .reg 文件
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{20338b7b-531c-4aad-8011-f5b3db2123ec}]
@="Contacts.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{36011842-dccc-40fe-aa3d-6177ea401788}]
@="Documents.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{3D1D4EA2-1D8C-418a-BFF8-F18370157B55}]
@="OtherUsers.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{4dcafe13-e6a7-4c28-be02-ca8c2126280d}]
@="Pictures.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{503a4e73-1734-441a-8eab-01b3f3861156}]
@="Communications.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{59BD6DD1-5CEC-4d7e-9AD2-ECC64154418D}]
@="UsersLibraries.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{71689ac1-cc88-45d0-8a22-2943c3e7dfb3}]
@="Music.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{7fde1a1e-8b31-49a5-93b8-6be14cfa4943}]
@="Generic.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{921C636D-9FC8-40d7-899E-0845DCD03010}]
@="PublishedItems.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{e053a11a-dced-4515-8c4e-d51ba917517b}]
@="UserFiles.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
[HKEY_CURRENT_USER\SOFTWARE\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell\{ea25fbd7-3bf7-409e-b97f-3352240903f4}]
@="Videos.SearchResults"
"Mode"=dword:00000004
"IconSize"=dword:00000010
"LogicalViewMode"=dword:00000001
所有这些不同的价值观是什么?
gci 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes' |
>> ?{(gp $_.PSPath).CanonicalName -match '\.S'} |
>> select PSCHildname, @{N='Name';E={(gp $_.PSPath).CanonicalName}}
PSChildName Name
----------- ----
{20338b7b-531c-4aad-8011-f5b3db2123ec} Contacts.SearchResults
{36011842-dccc-40fe-aa3d-6177ea401788} Documents.SearchResults
{3D1D4EA2-1D8C-418a-BFF8-F18370157B55} OtherUsers.SearchResults
{4dcafe13-e6a7-4c28-be02-ca8c2126280d} Pictures.SearchResults
{503a4e73-1734-441a-8eab-01b3f3861156} Communications.SearchResults
{59BD6DD1-5CEC-4d7e-9AD2-ECC64154418D} UsersLibraries.SearchResults
{71689ac1-cc88-45d0-8a22-2943c3e7dfb3} Music.SearchResults
{7fde1a1e-8b31-49a5-93b8-6be14cfa4943} Generic.SearchResults
{921C636D-9FC8-40d7-899E-0845DCD03010} PublishedItems.SearchResults
{e053a11a-dced-4515-8c4e-d51ba917517b} UserFiles.SearchResults
{ea25fbd7-3bf7-409e-b97f-3352240903f4} Videos.SearchResults
IconSize/LogicalViewMode/Mode/Vid 值:
Name LVM Mode Vid IconSize
---- --- ---- --- --------
Details 1 4 {137E7700-3573-11CF-AE69-08002B2E1262} 16
Tiles 2 6 {65F125E5-7BE1-4810-BA9D-D271C8432CE3} 48
SmIcons 3 1 {089000C0-3573-11CF-AE69-08002B2E1262} 16..31
Icons(M-XL) 3 1 {0057D0E0-3573-11CF-AE69-08002B2E1262} 33..256
List 4 3 {0E1FA5E0-3573-11CF-AE69-08002B2E1262} 16
Content 5 8 {30C2C434-0889-4C8D-985D-A9F71830B0A9} 32