Welcome Forums Aliases Run command line (DOS) applications

Viewing 0 reply threads
  • Author
    Posts
    • #449
      Tw|tchTw|tch
      Keymaster

      Description:
      Run command line (DOS) applications from mIRC

      Examples:

      
      ;shows netstat (you can also use parameters like -a)
      alias netstat { cmd netstat $1- }
      
      
      ;shows ipconfig (also parameters like /all)
      alias ipconfig { cmd ipconfig $1- }
      
      
      ;shows windows version
      alias ver { cmd ver }
      
      
      ;ping
      alias pings { cmd ping $$1- }
      
      
      alias net_users {
        cmd2 net view /DOMAIN
        var %i = 4,%l = $calc($cmd2(0) - 1)
        while (%i < %l) {
          echo -a  $+ $cmd2(%i)
          cmd2 -2 net view /DOMAIN: $+ $cmd2(%i)
          var %j = 4,%l2 = $calc($cmd2(0).2 - 1)
          while (%j < %l2) {
            var %n = $right($gettok($cmd2(%j).2,1,32),-2)
            cmd2 -3 tracert %n
            echo -a $chr(160) $spacer(%n,25) $iif($cmd2(2).3, $gettok($gettok($cmd2(2).3,2,91),1,93), Not responding)
            inc %j
          }
          inc %i
        }
        .remove cmd.2.txt
        .remove cmd.3.txt
      }
      
      alias -l spacer return $1 $+ $str($chr(160),$calc($2 - $len($1)))
      
      alias -l cmd2 {
        if ($prop) var %f = cmd. $+ $prop $+ .txt | else var %f = cmd.txt
        if (!$isid) && (-* iswm $1) { var %f = cmd. $+ $right($1,-1) $+ .txt | tokenize 32 $2- }
        if ($1 isnum) && ($2 == $null) return $iif($1,$read(%f,n,$1),$lines(%f))
        if (!$1) return %f
        if ($isfile(cmd.txt)) .remove %f
        if ($com(cmd2)) .comclose cmd2
        .comopen cmd2 WScript.Shell
        if (!$comerr) .comclose cmd2 $com(cmd2,Run,3,bstr,$+(%,comspec,%) /c $1 $2- > %f,uint,0,bool,true)
        if ($isid) return $lines(%f)
      }
      

      Code:

      
      ;; main alias
      alias cmd {
        if (!$window(@Commands)) window -elk0zv @Commands 0 0 679 468 "Georgia" 12 
        ;window -aw @Commands
        clear @Commands
        aline -p @Commands 10Requesting00(04 $$1- 00)10...
        aline @Commands $chr(9) 10This may take a few mins ...
        sline @Commands $line(@commands,0)
        var %x = $ticks, %p = $2-, %cm = $+(cmd.,$remove($1,\),%x), %f = $mircdir $+ %cm $+ .txt
        if ($com(%cm)) { .comclose %cm } 
        .comopen %cm WScript.Shell
        if ($comerr) { aline @Commands $com(%cm).errortext ~ $com(%cm).argerr }
        elseif (!$comerr) { .comclose %cm $com(%cm,Run,3,bstr,$+(%,comspec%) /c $1 %p > %f,uint,0,bool,true) }
        loadbuf @Commands %f 
        aline @Commands $chr(9) 
        aline -p @Commands 10Request00(04 $$1- 00) 10Processed. Duration00(04 $mss($calc($ticks - %x)) 00)
        ;aline @Commands $+(10,$left($scriptdir,-1),>)
        aline @Commands $chr(9)
        sline @Commands $line(@commands,0)
        ;run %f  
        .remove %f
        if ($isid) return $true
      }
      on *:INPUT:@Commands: { if ($left($1,1) != /) cmd $$1- }
      menu @Commands {
        $active Menu
        .Add Line to clipboard:clipboard -an $sline(@Commands,1)
        .Add all to clipboard:clipboard | var %x 1 | while (%x <= $line(@Commands,0)) { clipboard -an $line(@Commands,%x) | inc %x }
      }
      ;; alias for the duration with ms
      alias mss return $duration($left($1,-3)) $iif($int($right($1,3)),$ifmatch $+ ms)
      
      • This topic was modified 4 years, 9 months ago by Tw|tchTw|tch.
      • This topic was modified 4 years, 9 months ago by Tw|tchTw|tch.
Viewing 0 reply threads
  • The forum ‘Aliases’ is closed to new topics and replies.