ps:支持拖放 智能识别文件与文件夹 可以遍历文件夹的哦~
set ws=createobject("wscript.shell")
Set fso=CreateObject("Scripting.FileSystemObject")
if fso.fileexists("d:\乱码库文件.txt")=false then
ws.popup"请先建立乱码库文件(d:\乱码库文件.txt)! 请将乱码复制到乱码库文件然后保存.",4,"温馨提示",4096+64
set file=fso.createtextfile("d:\乱码库文件.txt",8,true)
file.close
ws.run"d:\乱码库文件.txt"
wscript.quit
else
set file=fso.opentextfile("d:\乱码库文件.txt")
n=file.readall
file.close
end if
if fso.folderexists(WScript.Arguments(0)) then
isfolder(WScript.Arguments(0))
else
convertfile(WScript.Arguments(0))
end if
ws.popup"处理完毕!",4,"温馨提示",64+4096
private sub isfolder(folders)
set folder=fso.getfolder(folders)
set files=folder.files
for each file in files
convertfile(file)
next
end sub
private sub convertfile(file)
for i=1 to len(n)
s=mid(n,i,1)
if s<>empty then
set fs=fso.opentextfile(file)
k=fs.readall
fs.close
d=replace(k,s,"")
Set objFile = fso.OpenTextFile(file,2)
objFile.write d
objfile.close
end if
next
end sub