欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

QueryCode.vbs 文本文件编码查询工具

程序员文章站 2022-04-29 09:17:38
只要下载此文件后便可以查询了. 下面是详细代码 复制代码 代码如下: 'querycode.vbs by: fastslz '支持批量查询,可以放在sendto扩展应用 s...
只要下载此文件后便可以查询了.
下面是详细代码
复制代码 代码如下:

'querycode.vbs by: fastslz
'支持批量查询,可以放在sendto扩展应用
set files=wscript.arguments
if files.count=0 then
msgbox "请将要查询的文件拖动到这个文件里! ", vbinformation, "文件编码查询工具 by: fastslz"
end if
for i=0 to files.count-1
file=files(i)
call checkcode ("   编码为:")
next
function checkcode (usage)
dim slz
set slz = createobject("adodb.stream")
slz.type = 1
slz.mode = 3
slz.open
slz.position = 0
slz.loadfromfile file
bin=slz.read(2)
if ascb(midb(bin,1,1))=&hef and ascb(midb(bin,2,1))=&hbb then
codes="utf-8"
elseif ascb(midb(bin,1,1))=&hff and ascb(midb(bin,2,1))=&hfe then
codes="unicode"
else
codes="gb2312"
end if
wscript.echo file,usage,codes
slz.close
set slz = nothing
end function

vbs代码下载