Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有很多编码的文件UTF-8,我想更改UTF-8为ANSI格式。我知道我可以使用notepadwindows 中的程序将文件重新保存为ANSIformat ,但是文件太多。
UTF-8
ANSI
notepad
那么我如何通过 powershell 改变它呢?谢谢
用于Get-Content将文件内容读入变量:
Get-Content
$contents = Get-Content foo.txt
然后用Out-File -Enc AsciiASCII 写回文件:
Out-File -Enc Ascii
$contents | Out-File foo.txt -Enc Ascii