5i365 (我心飞扬)当前离线
上尉
foreach ($F in gci *.txt) { $C = Get-Content $F [IO.File]::WriteAllLines($F, $C); }复制代码
TOP
gci *.bat | foreach{ $text = [IO.File]::ReadAllBytes($_.FullName) if (($text.Count -gt 3) -and ($text[0] -eq '239') -and ($text[1] -eq '187') -and ($text[2] -eq '191')) { $s = $text[3 .. ($text.Count - 1)] [IO.File]::WriteAllBytes($_.FullName, $s); } }复制代码
评分人数
Add-Type -Path "C:\chilkat\ChilkatDotNet48.dll"; $charset = New-Object Chilkat.Charset gci *.txt | foreach{ if ($charset.VerifyFile("bom-utf-8", $_.FullName)) { [IO.File]::WriteAllBytes($_.FullName, (gc -enc UTF8 $_.FullName)) } }复制代码