jcunews

Autorunner.vbs

May 8th, 2021 (edited)
1,026
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. 'Autorunner v1.0.2
  2. 'https://pastebin.com/u/jcunews
  3. 'https://www.reddit.com/user/jcunews1
  4. '
  5. 'Script to simply execute Autorun applications in the registry.
  6. 'This script will not restart Autorun applications which are already running.
  7. 'Nirsoft's disabled Autorun applications will not be processed.
  8. '
  9. 'Usage: autorunner RUN [/Y]"
  10. '
  11. 'RUN = Required command to run Autorun applications. Otherwise, usage help will be shown instead.
  12. '/Y  = Supress prompting and run all (enabled) Autorun applications.
  13.  
  14. if wsh.arguments.unnamed.count > 0 then
  15.   e = ucase(wsh.arguments.unnamed(0)) = "RUN"
  16. else
  17.   e = false
  18. end if
  19. if not e then
  20.   msgbox "Usage: autorunner RUN [/Y]" & vbcrlf & vbcrlf & _
  21.     "/Y = supress prompting and run all Autorun applications", 64, "Autorunner"
  22.   wsh.quit
  23. end if
  24. set ws = createobject("wscript.shell")
  25. set rg = getobject("winmgmts:stdregprov")
  26. ky = "Software\Microsoft\Windows\CurrentVersion\Run"
  27. for rt = 2147483650 to 2147483649 step -1
  28.   na = empty
  29.   ta = empty
  30.   if rg.enumvalues(rt, ky, na, ta) = 0 then
  31.     for i = 0 to ubound(na)
  32.       select case ta(i)
  33.         case 1
  34.           e = rg.getstringvalue(rt, ky, na(i), s)
  35.         case 2
  36.           e = rg.getexpandedstringvalue(rt, ky, na(i), s)
  37.         case else
  38.           e = 1
  39.       end select
  40.       if s <> "" then if left(s, 1) = ":" then e = 1 'Nirsoft's disabled entry
  41.      if e = 0 then
  42.         if wsh.arguments.named.exists("Y") then
  43.           e = 6 'yes
  44.        else
  45.           e = msgbox("Run this Autorun application?" & vbcrlf & vbcrlf & _
  46.             "Name: " & vbcrlf & na(i) & vbcrlf & vbcrlf & "Command line:" & _
  47.             vbcrlf & s, 35 + 4096, "Autorunner")
  48.         end if
  49.         if e = 6 then 'yes
  50.          on error resume next
  51.           ws.run s, 1
  52.           on error goto 0
  53.         elseif e = 2 then 'cancel
  54.          wsh.quit
  55.         end if
  56.       end if
  57.     next
  58.   end if
  59. next
  60.  
Add Comment
Please, Sign In to add comment