求批处理,把拖入文本都变成UTF-8编码
只要能把拖入的ANSI和unicode编码的文本转成UTF-8就好了。要能插在bat里执行的就可以了嗯。只要能让bat处理过后编码能统一就好了。ANSI编码也可以的,不一...
只要能把拖入的ANSI和unicode编码的文本转成UTF-8就好了。
要能插在bat里执行的就可以了嗯。
只要能让bat处理过后编码能统一就好了。ANSI编码也可以的,不一定要UTF-8(最好是UTF-8) 展开
要能插在bat里执行的就可以了嗯。
只要能让bat处理过后编码能统一就好了。ANSI编码也可以的,不一定要UTF-8(最好是UTF-8) 展开
展开全部
::不清楚你的批量是怎么个批量法,只写了转换的部分,批量处理需要你说明要求才能写
::
:: file2utf8.bat
:::::::::::::::::::::::::::::::::::::::::::::::::::
::文件编码转换 GB2312 or UNICODE to UTF-8
:: by OGRobot at 2011-11-09
::
:: 执行方式:
:: file2utf8.bat 文件名
::
@echo off
set Script=%temp%\FileToUtf8.vbs
echo function checkcode(path) > %Script%
echo set inStream=CreateObject("ADODB.Stream") >> %Script%
echo inStream.Type=1 >> %Script%
echo inStream.Mode=3 >> %Script%
echo inStream.Open >> %Script%
echo inStream.Position=0 >> %Script%
echo inStream.LoadFromFile path >> %Script%
echo bom=inStream.Read(2) >> %Script%
echo If AscB(MidB(bom,1,1))=^&HEF And AscB(MidB(bom,2,1))=^&HBB Then >> %Script%
echo checkcode="UTF-8" >> %Script%
echo ElseIf AscB(MidB(bom,1,1))=^&HFF And AscB(MidB(bom,2,1))=^&HFE Then >> %Script%
echo checkcode="UNICODE" >> %Script%
echo Else >> %Script%
echo checkcode="GB2312" >> %Script%
echo End If >> %Script%
echo inStream.Close >> %Script%
echo set inStream=nothing >> %Script%
echo end function >> %Script%
echo/ >> %Script%
echo inCharset=checkcode(Wscript.Arguments(0)) >> %Script%
echo If inCharset^<^>"UTF-8" Then >> %Script%
echo set fso=CreateObject("Scripting.FileSystemObject") >> %Script%
echo fso.CopyFile Wscript.Arguments(0), Wscript.Arguments(0) ^& ".bak" >> %Script%
echo set inStream=CreateObject("ADODB.Stream") >> %Script%
echo inStream.Type=2 >> %Script%
echo inStream.Mode=3 >> %Script%
echo inStream.Charset=inCharset >> %Script%
echo inStream.Open >> %Script%
echo inStream.LoadFromFile Wscript.Arguments(0) >> %Script%
echo buf=inStream.ReadText >> %Script%
echo inStream.Close >> %Script%
echo set inStream=nothing >> %Script%
echo/ >> %Script%
echo set outStream=CreateObject("ADODB.Stream") >> %Script%
echo outStream.Type=2 >> %Script%
echo outStream.Mode=3 >> %Script%
echo outStream.Charset="UTF-8" >> %Script%
echo outStream.Open >> %Script%
echo outStream.WriteText buf >> %Script%
echo outStream.SaveToFile Wscript.Arguments(0), 2 >> %Script%
echo outStream.Flush >> %Script%
echo outStream.Close >> %Script%
echo set outStream=nothing >> %Script%
echo End If >> %Script%
%Script% %1
del %Script%
::
:: file2utf8.bat
:::::::::::::::::::::::::::::::::::::::::::::::::::
::文件编码转换 GB2312 or UNICODE to UTF-8
:: by OGRobot at 2011-11-09
::
:: 执行方式:
:: file2utf8.bat 文件名
::
@echo off
set Script=%temp%\FileToUtf8.vbs
echo function checkcode(path) > %Script%
echo set inStream=CreateObject("ADODB.Stream") >> %Script%
echo inStream.Type=1 >> %Script%
echo inStream.Mode=3 >> %Script%
echo inStream.Open >> %Script%
echo inStream.Position=0 >> %Script%
echo inStream.LoadFromFile path >> %Script%
echo bom=inStream.Read(2) >> %Script%
echo If AscB(MidB(bom,1,1))=^&HEF And AscB(MidB(bom,2,1))=^&HBB Then >> %Script%
echo checkcode="UTF-8" >> %Script%
echo ElseIf AscB(MidB(bom,1,1))=^&HFF And AscB(MidB(bom,2,1))=^&HFE Then >> %Script%
echo checkcode="UNICODE" >> %Script%
echo Else >> %Script%
echo checkcode="GB2312" >> %Script%
echo End If >> %Script%
echo inStream.Close >> %Script%
echo set inStream=nothing >> %Script%
echo end function >> %Script%
echo/ >> %Script%
echo inCharset=checkcode(Wscript.Arguments(0)) >> %Script%
echo If inCharset^<^>"UTF-8" Then >> %Script%
echo set fso=CreateObject("Scripting.FileSystemObject") >> %Script%
echo fso.CopyFile Wscript.Arguments(0), Wscript.Arguments(0) ^& ".bak" >> %Script%
echo set inStream=CreateObject("ADODB.Stream") >> %Script%
echo inStream.Type=2 >> %Script%
echo inStream.Mode=3 >> %Script%
echo inStream.Charset=inCharset >> %Script%
echo inStream.Open >> %Script%
echo inStream.LoadFromFile Wscript.Arguments(0) >> %Script%
echo buf=inStream.ReadText >> %Script%
echo inStream.Close >> %Script%
echo set inStream=nothing >> %Script%
echo/ >> %Script%
echo set outStream=CreateObject("ADODB.Stream") >> %Script%
echo outStream.Type=2 >> %Script%
echo outStream.Mode=3 >> %Script%
echo outStream.Charset="UTF-8" >> %Script%
echo outStream.Open >> %Script%
echo outStream.WriteText buf >> %Script%
echo outStream.SaveToFile Wscript.Arguments(0), 2 >> %Script%
echo outStream.Flush >> %Script%
echo outStream.Close >> %Script%
echo set outStream=nothing >> %Script%
echo End If >> %Script%
%Script% %1
del %Script%
上海巴鲁图工程机械科技有限公司_
2022-05-15 广告
2022-05-15 广告
光电编码器,是一种通过光电转换将输出轴上的机械几何位移量转换成脉冲或数字量的传感器。光电编码器每转输出60(我们用老板没有说)个脉冲,五线制。其中两根为电源线,三根为脉冲线(A相、B相、Z)。电源的工作电压为 (+5~+24V)直流电源。光...
点击进入详情页
本回答由上海巴鲁图工程机械科技有限公司_提供
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询