本帖最后由 zaqmlp 于 2024-3-17 20:48 编辑
- @echo off
- powershell -NoProfile -ExecutionPolicy bypass ^
- $enc=[Text.Encoding]::Default;^
- $files=@(dir -liter '%~dp0'^|?{('.txt' -eq $_.Extension) -and ($_ -is [System.IO.FileInfo])});^
- for($i=0;$i -lt $files.Count;$i++){^
- write-host $files[$i].FullName;^
- $text=[IO.File]::ReadAllText($files[$i].FullName, $enc);^
- $text=$text -replace '\s*$','';^
- [IO.File]::WriteAllText($files[$i].FullName, $text, $enc);^
- };
- pause
复制代码
|