- @echo off&setlocal enabledelayedexpansion
- del /q test*.ini>nul 2>nul
- md 已完成>nul 2>nul
- md 原文件>nul 2>nul
- echo.
- echo 流程:先转码,后替换。保留原文件。可随时停止。
- pause>nul
- for /f "delims=*" %%g in ('dir /b/on *.txt') do (
- iconv -c -f utf-8 -t gb2312 "%%g" test.ini
- for /f "delims=" %%c in ('type "test.ini"') do (
- set "foo=%%c"
- set foo=!foo:原来的=替换后的!
- set foo=!foo:原来的=替换后的!
- echo 如上多次重复并根据需要修改
- echo foo
- )>>test1.ini
- move /y test1.ini 已完成\%%g>nul 2>nul
- move /y "%%g" 原文件\%%g>nul 2>nul
- del /q test*.ini
- )
- echo 全部完成
- pause
复制代码 未测试,注意保护原文件。和txt放一起使用。 |