Advertisement
iPeer

/run with system variable support...

May 26th, 2011
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 0.87 KB | None | 0 0
  1. alias run {
  2.   var %r $1-
  3.   :varcheck
  4.   if ($regex(%r,/%([0-9a-zA-Z]+)%/S)) {
  5.     var %r $regsubex(%r,/%([0-9a-zA-Z]+)%/Sg,$sysvar(\t))
  6.     goto varcheck
  7.   }
  8.   else {
  9.     if (*Invalid Path* iswmcs %r) { echo $color(info) * /run: one or more variables were invalid. | halt }
  10.     !run %r
  11.   }
  12.   halt
  13.   :error
  14.   haltdef
  15.   echo $color(info) $gettok($error,1,40)
  16.   reseterror
  17.   halt
  18. }
  19. alias sysvar {
  20.   var %var $1
  21.   unset %error
  22.   .comopen s Wscript.Shell
  23.   noop $com(s,RegRead,1,bstr,$+(HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment\,%var))
  24.   var %x $com(s).result
  25.   noop $com(s,RegRead,1,bstr,$+(HKCU\Volatile Environment\,%var))
  26.   var %y $com(s).result
  27.   noop $com(s,RegRead,1,bstr,$+(HKCU\Software\Liter\SystemInfo\SystemFolders\,%var))
  28.   var %z $com(s).result
  29.   .comclose s
  30.   return $iif(%x,$v1,$iif(%y,$v1,$iif(%z,$v1,Invalid Path)))
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement