本帖最后由 amwfjhh 于 2014-11-26 12:36 编辑
- @if (0)==(0) echo off
- cscript -nologo -e:jscript %~s0 userinfo.sql utf-8 new.sql gb2312
- REM Do something here...
- pause
- goto :EOF
- @end
-
- //jscode
- var stream, strContent;
- var fileIn, fileOut;
- var inCode, outCode;
-
- if (WSH.arguments.length < 4) {
- WSH.ECHO("参数不完全……");
- WSH.ECHO("Usage: xxx fileIn inCode fileOut outCode");
- WSH.Quit();
- }
-
- fileIn = WSH.arguments(0);
- inCode = WSH.arguments(1);
- fileOut = WSH.arguments(2);
- outCode = WSH.arguments(3);
-
- if (fileIn == "" || inCode == "" || fileOut== "" || outCode == "") {
- WSH.ECHO("参数不完全……");
- WSH.ECHO("Usage: xxx fileIn inCode fileOut outCode");
- WSH.Quit();
- }
-
- stream = WSH.createobject("adodb.stream");
-
- stream.open();
- stream.charset = inCode;
- stream.LoadFromFile(fileIn);
- strContent = stream.ReadText();
- stream.Close();
-
- stream.Mode = 3;
- stream.Open();
- stream.Charset = outCode;
- stream.WriteText(strContent);
- stream.SaveToFile(fileOut, 2);
- stream.Close();
复制代码 先转成可识别的ANSI字符集,再进行处理。 |