Board logo

标题: [文件操作] [分享]文本文件拖放UTF-8转ANSI的批处理 [打印本页]

作者: yakeyun    时间: 2022-4-29 15:32     标题: [分享]文本文件拖放UTF-8转ANSI的批处理

代码调用了批处理之家的第三方脚本下载地址,所以需要保证有网的情况下执行。
保存脚本为ANSI,把要转换的文本图标拖放到脚本即可开始转换。
只要联网用过一次后,后面再使用,即使没有网络也能运行。
  1. @echo off & cd /d "%~dp0" & setlocal enabledelayedexpansion
  2. if not exist %SystemRoot%\System32\iconv.exe (curl -O http://bcn.bathome.net/tool/iconv.exe & move /y "iconv.exe" "%SystemRoot%\System32\iconv.exe")
  3. if not exist %SystemRoot%\System32\iconv.exe (mshta "vbscript:msgbox("当前网络不可用,无法继续执行!",0,"提醒:") & window.close" & exit )
  4. set file=%~nx1
  5. set wfiles=%file%
  6. iconv -c -f utf-8 -t gb2312 "%wfiles%" >"ANSI_%wfiles%"
  7. exit
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2