使用PowerShell修改文件属性的方法,比如要将文件的Hidden及System属性去除:
=============================================================
PS I:/> $attrib = [System.IO.FileAttributes]::Hidden -bor [Syste
m.IO.FileAttributes]::System
PS I:/> gci -Force | foreach { if (($_.Attributes -band $attrib) -eq $attrib) {$
_Attributes -= $attrib}}
=============================================================
注意运算符的优先级。(-bor : |, -band : &, -eq : =)