mIRC Home    About    Download    Register    News    Help

Print Thread
com for doscmd #188895 01/11/07 01:59 PM
Joined: Sep 2003
Posts: 84
T
Turbo_boy Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Sep 2003
Posts: 84
Hello there,

I'm trying to make a script that execute a dos command and give
the results back.

But now I found the option $com but how to use it for doing dos commands? And is it possible to use it.

(I used dll's but after a while it just let irc crash :()

Re: com for doscmd [Re: Turbo_boy] #188896 01/11/07 02:15 PM
Joined: Dec 2002
Posts: 3,138
C
Collective Offline
Hoopy frood
Offline
Hoopy frood
C
Joined: Dec 2002
Posts: 3,138
You can use WScript.Shell's Exec() method, it won't allow you to hide the command window, though. Run() does, but you can't catch the output with that.

See here for an example script.

Re: com for doscmd [Re: Collective] #188898 01/11/07 02:42 PM
Joined: Sep 2003
Posts: 84
T
Turbo_boy Offline OP
Babel fish
OP Offline
Babel fish
T
Joined: Sep 2003
Posts: 84
Thnx, it does just what I needed.

Re: com for doscmd [Re: Turbo_boy] #189107 04/11/07 01:45 AM
Joined: Mar 2006
Posts: 393
T
The_JD Offline
Fjord artisan
Offline
Fjord artisan
T
Joined: Mar 2006
Posts: 393
Oh, just had a look... nice work

To make it close...

change this line:
Code:
   if ( !$com(stdcatch.shell $+ %i,Exec,1,bstr,$1-,dispatch* stdcatch.exec $+ %i) ) || ( !$com(stdcatch.exec $+ %i) ) { 


to this:
Code:
   if ( !$com(stdcatch.shell $+ %i,Exec,1,bstr,cmd.exe /C $+ $1-,dispatch* stdcatch.exec $+ %i) ) || ( !$com(stdcatch.exec $+ %i) ) { 


Obviously CMD.EXE only works on Windows NT... but you would change it to command.com if you were on Windows 9X.

Hope it helps


[02:16] * Titanic has quit IRC (Excess Flood)