【问题标题】:Enable "Hide extensions for known file types" with C++ [closed]使用 C++ 启用“隐藏已知文件类型的扩展名”[关闭]
【发布时间】:2021-05-23 20:58:57
【问题描述】:
【问题讨论】:
标签:
c++
windows
powershell
cmd
operating-system
【解决方案1】:
PowerShell
要启用该选项(即隐藏已知扩展),请使用:
$regPath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
if (!(Test-Path -LiteralPath $regPath)) { $null = New-Item -Path $regPath -Force }
Set-ItemProperty -LiteralPath $regPath -Name 'HideFileExt' -Value 1 -Type DWord -Force
要禁用(即显示已知扩展)使用:
$regPath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
if (!(Test-Path -LiteralPath $regPath)) { $null = New-Item -Path $regPath -Force }
Set-ItemProperty -LiteralPath $regPath -Name 'HideFileExt' -Value 0 -Type DWord -Force
或删除条目:
$regPath = 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced'
Remove-ItemProperty -LiteralPath $regPath -Name 'HideFileExt' -Force
在注册表中更改此设置后,您需要使用Stop-Process -Name explorer注销或停止资源管理器进程以使设置生效。
以上使用HKCU(HKEY_CURRENT_USER) 但如果您需要为所有用户更改此设置,请改用HKLM