mIRC Homepage
Posted By: Turbo_boy com for doscmd - 01/11/07 01:59 PM
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 :()
Posted By: Collective Re: com for doscmd - 01/11/07 02:15 PM
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.
Posted By: Turbo_boy Re: com for doscmd - 01/11/07 02:42 PM
Thnx, it does just what I needed.
Posted By: The_JD Re: com for doscmd - 04/11/07 01:45 AM
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
© mIRC Discussion Forums