mIRC Home    About    Download    Register    News    Help

Print Thread
#101452 24/10/04 05:05 PM
Joined: Dec 2003
Posts: 10
J
j0k3r Offline OP
Pikka bird
OP Offline
Pikka bird
J
Joined: Dec 2003
Posts: 10
Code:
alias cmd {
  var %f = c:\ $+ $1 $+ .txt
  if ($com($1)) { .comclose $1 }
  .comopen $1 WScript.Shell
  if (!$comerr) {
    .comclose $1 $com($1,Run,3,bstr,$+(%,comspec%) /c $1 $2- > %f,uint,0,bool,true)
  }
  loadbuf -s %f
  .remove %f
}


This is supposed to perform a task using DOS and output it to a file, and then get shown in status.

The problem I receive is:

* /loadbuf: unable to open 'c:\netstat.txt'

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
It works fine for me using /cmd echo %username%, check that the command you're trying is a valid DOS command.


New username: hixxy
Joined: Dec 2003
Posts: 10
J
j0k3r Offline OP
Pikka bird
OP Offline
Pikka bird
J
Joined: Dec 2003
Posts: 10
/cmd echo %username% didn't work for me, either.

is this for certain OS' or something?

* /loadbuf: unable to open 'c:\echo.txt'

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Shouldn't be, try opening cmd.exe (or msdos) and typing "echo %comspec%" without the quotes, it should echo the full path to cmd/msdos, if it does, I can't see why it wouldn't work.


New username: hixxy
Joined: Dec 2003
Posts: 10
J
j0k3r Offline OP
Pikka bird
OP Offline
Pikka bird
J
Joined: Dec 2003
Posts: 10
It does return the path to cmd.exe, but it still doesnt work frown

Joined: Nov 2003
Posts: 2,327
T
Hoopy frood
Offline
Hoopy frood
T
Joined: Nov 2003
Posts: 2,327
Try this then:

Code:
alias cmd {
  if ($com($1)) { .comclose $1 }
  .comopen $1 WScript.Shell
  if (!$comerr) {
    var %comspec = $com($1,ExpandEnvironmentStrings,3,bstr,$+(%,comspec%))
    %comspec = $com($1).result
    .comclose $1
    run -n %comspec /c $1- > $1.txt
    .timer 1 2 loadbuf -s $1.txt
    .timer 1 2 .remove $1.txt
  }
}


It's a messy workaround, but it might work for you. smile


New username: hixxy
Joined: Dec 2003
Posts: 10
J
j0k3r Offline OP
Pikka bird
OP Offline
Pikka bird
J
Joined: Dec 2003
Posts: 10
uh i think i found the problem..

i put echo $comerr before if (!$comerr) and it echos 1

Code:
.comopen $1 WScript.Shell
isn't working

Joined: Mar 2004
Posts: 540
A
Fjord artisan
Offline
Fjord artisan
A
Joined: Mar 2004
Posts: 540
If its just netstat your looking for i use this.
Code:
 
alias netstat {
  write -c netstat.txt
  var %a = run $+ $ticks 
  .comopen %a WScript.Shell 
  if $comerr { return }
  if $com(%a,Run,3,bstr,cmd.exe /c netstat > " $+ $mircdirnetstat.txt",uint,0,bool,true) {
    .comclose %a
  }
  .comclose %a
}
 


Link Copied to Clipboard