通过PowershellconfigurationWindows资源pipe理器文件夹选项

我正在寻找一种方法来通过Powershell在Windows资源pipe理器的文件夹选项对话框中configuration几个选项。

选项是:

  • select“显示隐藏的文件,文件夹和驱动器”
  • 取消选中“隐藏已知文件types的扩展名”
  • 取消选中“隐藏受保护的操作系统文件(推荐)”

Keith的回答对我来说并不适用。 用于修改registry值的唯一方法是ShowSuperHidden。 当我打开文件夹设置中的查看选项卡时,隐藏(显示隐藏的文件…)和HideFileExt(隐藏文件扩展名)将恢复为其先前的值。

这是我的解决scheme,我经过一些试验和错误(explorer.exe自动重新启动)后发现:

$key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' Set-ItemProperty $key Hidden 1 Set-ItemProperty $key HideFileExt 0 Set-ItemProperty $key ShowSuperHidden 1 Stop-Process -processname explorer 

我在Windows Server 2008 R2和Windows 7上testing了这个。

我相信这些对应registry项在registry项HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced 。 您可以使用Set-ItemProperty cmdlet更改其值,例如:

 $key = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' Set-ItemProperty $key ShowSuperHidden 1 

本地机器似乎还有一个对应的键(与上面的每个用户设置相对应): HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\Folder

一些常见的探险家调整

 Windows Registry Editor Version 5.00 [hkey_current_user\software\microsoft\windows\currentversion\explorer\advanced] ;hide empty drives [uncheck] "hidedriveswithnomedia"=dword:00000000 ;hide extensions for known file types [uncheck] "hidefileext"=dword:00000000 ;show hidden files, folders, and drives [check] "showsuperhidden"=dword:00000001 ;hide folder merge conflicts [uncheck] "hidemergeconflicts"=dword:00000000 ;hide protected operating system files (recommended) [uncheck] "hidden"=dword:00000001 ;use check boxes to select items [check] "autocheckselect"=dword:00000001 

保存为file.reg ,然后通过单击或使用reg /import (cli)

ps:不需要浏览器或系统重新启动