根据上一篇powershell生成pro的方法,增加一个批量修改文本文件为utf8格式的方法

$incPath = dir -filter "*.c" -Recurse
$temp = " "
foreach($fpath in $incPath)
{
    $headList=$fpath.DirectoryName + "\" + $fpath.name
    $temp = cat $headList
    $temp | Out-File -Encoding utf8 $headList
}

经实践发现,如果文本本身是ASCII或者utf8,使用这一个脚本没有问题,但是若是文本本身是utf8无BOM格式,则会乱码。所以powershell可能无法完成,需要使用python了。

相关文章:

  • 2021-06-10
  • 2021-12-27
  • 2021-09-21
  • 2022-01-17
  • 2022-12-23
  • 2021-11-23
  • 2021-09-05
  • 2021-05-06
猜你喜欢
  • 2021-09-17
  • 2021-11-21
  • 2021-12-26
  • 2021-09-21
  • 2022-12-23
  • 2021-12-24
  • 2021-07-22
相关资源
相似解决方案