【问题标题】:Enable "Hide extensions for known file types" with C++ [closed]使用 C++ 启用“隐藏已知文件类型的扩展名”[关闭]
【发布时间】:2021-05-23 20:58:57
【问题描述】:

我想知道如何在 C++ 中启用/禁用 隐藏已知文件类型的扩展名(旧版本也可以)。

How to enable it in Windows Explorer

How to enable it in File Explorer Options

如果不能在 c++ 中执行,我也可以使用 cmd/powershell!

提前致谢!

【问题讨论】:

    标签: 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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-04-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-10-06
      • 2019-02-06
      • 2014-03-29
      • 1970-01-01
      相关资源
      最近更新 更多