在Windows上递归更改文件的编码? [英] Change files' encoding recursively on Windows?

查看:76
本文介绍了在Windows上递归更改文件的编码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道一种工具,最好是用于Explorer上下文菜单的工具,用于将项目中文件的编码从ISO-8859-1递归更改为UTF-8以及其他编码吗?免费软件还是不太昂贵会很棒.

Does anybody know a tool, preferably for the Explorer context menu, to recursively change the encoding of files in a project from ISO-8859-1 to UTF-8 and other encodings? Freeware or not too expensive would be great.

编辑:感谢您的回答,所有内容均为+1.但是我真的很想能够右键单击一个文件夹并说将所有.php文件转换为UTF-8". :)希望进一步提出建议,并开始赏金.

Thanks for the answers, +1 for all of then. But I would really like to be able to just right click a folder and say "convert all .php files to UTF-8". :) Further suggestions are appreciated, starting a bounty.

推荐答案

您可以使用Windows PowerShell轻松实现类似目的.如果您获得了文件的内容,则可以将其通过管道传输到Out-File cmdlet,并指定UTF8作为编码.

You could easily achieve something like this using Windows PowerShell. If you got the content for a file you could pipe this to the Out-File cmdlet specifying UTF8 as the encoding.

尝试类似的东西:

Get-ChildItem *.txt -Recurse | ForEach-Object {
$content = $_ | Get-Content

Set-Content -PassThru $_.Fullname $content -Encoding UTF8 -Force}  

这篇关于在Windows上递归更改文件的编码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆