只要下载此文件后便可以查询了.
下面是详细代码
'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代码下载