【问题标题】:Change the Show Hidden Items setting on a folder更改文件夹上的显示隐藏项目设置
【发布时间】:2015-04-25 15:02:31
【问题描述】:

在存储的特定文件夹上“显示/隐藏项目”的设置在哪里?

我希望能够以编程方式更改它,希望在 Powershell 中。

【问题讨论】:

  • 对不起,我不明白,您要更改文件系统属性吗?
  • 如果这是为某个文件夹存储该设置的位置,那么“是”。
  • 看起来我错了能够在文件夹级别设置它。

标签: windows powershell windows-8.1


【解决方案1】:

所以试试这个:

$file = "c:\temp\t.txt"
# Hidde  $file
Set-ItemProperty -Path $file -Name attributes  -Value ([io.fileattributes]::Hidden)
# Remove Hidden if set 
Set-ItemProperty -Path $file -Name attributes  -Value ((Get-ItemProperty $file).attributes -bxor ([io.fileattributes]::Hidden))

【讨论】:

    【解决方案2】:

    我试试你的代码,但这部分不起作用:

    Set-ItemProperty -Path $file -Name attributes  -Value ((Get-ItemProperty $file).attributes -bxor ([io.fileattributes]::Hidden))
    

    我只是用“正常”替换“隐藏”,它的工作:

    Set-ItemProperty -Path $file -Name attributes  -Value ([io.fileattributes]::Normal)
    

    谢谢。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-01-22
      • 1970-01-01
      • 2013-08-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多