百度空间 | 百度首页 
               
 
查看文章
 
文本去乱码(又是原创 智能识别文件与文件夹 很实用哦 ~)
2008-08-28 11:27

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


类别:vbs技术 | 添加到搜藏 | 浏览() | 评论 (0)
 
最近读者:
 
网友评论:
发表评论:
姓 名:
网址或邮箱: (选填)
内 容:
验证码: 请点击后输入四位验证码,字母不区分大小写
      

     

©2009 Baidu