[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
  1. @echo off
  2. set "filepath=e:\test\[1-9].txt"
  3. Powershell -NoProfile -Command "Get-ChildItem -Path \"%filepath%\"|ForEach-object {$arr = Get-Content -ReadCount 0 -Path $_ -Encoding utf8 ; Set-Content -Value $arr -Path $_ -Encoding utf8}"
  4. pause
  5. exit /b
复制代码
微信:flashercs
QQ:49908356

TOP

本帖最后由 flashercs 于 2019-8-26 13:38 编辑

回复 8# zhaosiyu2010
  1. @echo off
  2. set "filepath=e:\test\[1-9].txt"
  3. Powershell -NoProfile -Command "Get-ChildItem -Path \"%filepath%\" | ForEach-object { [System.IO.File]::WriteAllText($_.FullName, [System.IO.File]::ReadAllText($_.FullName, [System.Text.UTF8Encoding]::UTF8), (New-Object System.Text.UTF8Encoding -ArgumentList $true)) }"
  4. pause
  5. exit /b
复制代码
微信:flashercs
QQ:49908356

TOP

本帖最后由 flashercs 于 2019-12-4 10:44 编辑

回复 11# zhaosiyu2010
  1. @echo off
  2. set "filepath=C:\Users\*.txt"
  3. REM srcEncoding=UTF8 or Default
  4. set srcEncoding=Default
  5. Powershell -NoProfile -Command "$srcEncoding=[System.Text.Encoding]::%srcEncoding%;$utf8bom=New-Object System.Text.UTF8Encoding -ArgumentList $true;Get-ChildItem -Path \"%filepath%\" | ForEach-Object { [System.IO.File]::WriteAllText($_.FullName, [System.IO.File]::ReadAllText($_.FullName, $srcEncoding), $utf8bom) }"
  6. pause
  7. exit /b
复制代码
1

评分人数

微信:flashercs
QQ:49908356

TOP

返回列表