Advertisement
Guest User

Untitled

a guest
Feb 9th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
mIRC 2.92 KB | None | 0 0
  1. ;; alias to run DOS applications like PING and so on
  2. ;; displays output in a @window called like the first parameter
  3. ;;
  4. ;; best view with font IBMPC - please install it at first ;)
  5. ;;
  6. ;; for example:
  7. ;; /cmd netstat -a
  8. ;; prints output to @netstat
  9. ;;
  10.  
  11. ;; examples
  12. ;shows netstat (you can also use parameters like -a)
  13. alias netstat { cmd netstat $1- }
  14.  
  15. ;shows ipconfig (also parameters like /all)
  16. alias ipconfig { cmd ipconfig $1- }
  17.  
  18. ;shows windows version
  19. alias ver { cmd ver }
  20.  
  21. ;ping
  22. alias pings { cmd ping $$1- }
  23.  
  24. alias net_users {
  25.   cmd2 net view /DOMAIN
  26.   var %i = 4,%l = $calc($cmd2(0) - 1)
  27.   while (%i < %l) {
  28.     echo -a  $+ $cmd2(%i)
  29.     cmd2 -2 net view /DOMAIN: $+ $cmd2(%i)
  30.     var %j = 4,%l2 = $calc($cmd2(0).2 - 1)
  31.     while (%j < %l2) {
  32.       var %n = $right($gettok($cmd2(%j).2,1,32),-2)
  33.       cmd2 -3 tracert %n
  34.       echo -a $chr(160) $spacer(%n,25) $iif($cmd2(2).3, $gettok($gettok($cmd2(2).3,2,91),1,93), Not responding)
  35.       inc %j
  36.     }
  37.     inc %i
  38.   }
  39.   .remove cmd.2.txt
  40.   .remove cmd.3.txt
  41. }
  42. alias -l spacer return $1 $+ $str($chr(160),$calc($2 - $len($1)))
  43. alias -l cmd2 {
  44.   if ($prop) var %f = cmd. $+ $prop $+ .txt | else var %f = cmd.txt
  45.   if (!$isid) && (-* iswm $1) { var %f = cmd. $+ $right($1,-1) $+ .txt | tokenize 32 $2- }
  46.   if ($1 isnum) && ($2 == $null) return $iif($1,$read(%f,n,$1),$lines(%f))
  47.   if (!$1) return %f
  48.   if ($isfile(cmd.txt)) .remove %f
  49.   if ($com(cmd2)) .comclose cmd2
  50.   .comopen cmd2 WScript.Shell
  51.   if (!$comerr) .comclose cmd2 $com(cmd2,Run,3,bstr,$+(%,comspec,%) /c $1 $2- > %f,uint,0,bool,true)
  52.   if ($isid) return $lines(%f)
  53. }
  54. ;; main alias
  55. alias cmd {
  56.   if (!$window(@Commands)) window -elk0zv @Commands 0 0 679 468 "Georgia" 12
  57.   ;window -aw @Commands
  58.   clear @Commands
  59.   aline -p @Commands 10Requesting00(04 $$1- 00)10...
  60.   aline @Commands $chr(9) 10This may take a few mins ...
  61.   sline @Commands $line(@commands,0)
  62.   var %x = $ticks, %p = $2-, %cm = $+(cmd.,$remove($1,\),%x), %f = $mircdir $+ %cm $+ .txt
  63.   if ($com(%cm)) { .comclose %cm }
  64.   .comopen %cm WScript.Shell
  65.   if ($comerr) { aline @Commands $com(%cm).errortext ~ $com(%cm).argerr }
  66.   elseif (!$comerr) { .comclose %cm $com(%cm,Run,3,bstr,$+(%,comspec%) /c $1 %p > %f,uint,0,bool,true) }
  67.   loadbuf @Commands %f
  68.   aline @Commands $chr(9)
  69.   aline -p @Commands 10Request00(04 $$1- 00) 10Processed. Duration00(04 $mss($calc($ticks - %x)) 00)
  70.   ;aline @Commands $+(10,$left($scriptdir,-1),>)
  71.   aline @Commands $chr(9)
  72.   sline @Commands $line(@commands,0)
  73.   ;run %f  
  74.   .remove %f
  75.   if ($isid) return $true
  76. }
  77. on *:INPUT:@Commands: { if ($left($1,1) != /) cmd $$1- }
  78. menu @Commands {
  79.   $active Menu
  80.   .Add Line to clipboard:clipboard -an $sline(@Commands,1)
  81.   .Add all to clipboard:clipboard | var %x 1 | while (%x <= $line(@Commands,0)) { clipboard -an $line(@Commands,%x) | inc %x }
  82. }
  83. ;; alias for the duration with ms
  84. alias mss return $duration($left($1,-3)) $iif($int($right($1,3)),$ifmatch $+ ms)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement