mIRC Homepage
Posted By: firefox /run command - 22/02/11 05:16 PM
/run C:\Windows\System32\cmd.exe /c $1

closes the window after running the commands

Can I make it so the window doesn't show at all?
Posted By: Rewtor Re: /run command - 22/02/11 05:19 PM
I needed this a while back, I think this is what you're looking for: http://www.ntwind.com/software/utilities/hstart.html
Posted By: westor Re: /run command - 22/02/11 05:47 PM
You can use
Code:
The -n switch minimizes the window of the application being run.
Posted By: Tomao Re: /run command - 22/02/11 08:24 PM
The -n switch only minimizes the window but won't hide it.
Posted By: Riamus2 Re: /run command - 22/02/11 10:14 PM
True, but I believe that's about the best you can do without running another program that doesn't come with Windows.
Posted By: hixxy Re: /run command - 22/02/11 10:27 PM
You can do this with the wscript.shell COM object:

Code:
alias runex {
  .comopen runex wscript.shell
  if (!$comerr) { .comclose runex $com(runex,run,3,bstr,$1-,int,0,bool,$false) }
}


This completely hides the window, it doesn't just minimise it.

As an added benefit, if you want the script to wait until the program has finished executing before continuing, change "bool,$false" to "bool,$true" smile
Posted By: argv0 Re: /run command - 23/02/11 01:49 AM
Also see exec.dll for a way to silently run programs, as well as capture their output.
Posted By: Tomao Re: /run command - 23/02/11 02:40 AM
hixxy, I gave it a shot trying /runex file.txt but nothing happens. Isn't it supposed to open file.txt for me without showing the window?

I also try running programs with .exe extension but nothing happens too.
Posted By: hixxy Re: /run command - 23/02/11 08:05 AM
You need to supply the full path to the file, and nothing will happen because the window is hidden. If I do this:

Code:
//write x.txt test | runex $qt($mircdirx.txt)


And then check in the task manager processes tab, I can see "notepad.exe" running, but there is no window because it's hidden.
Posted By: Tomao Re: /run command - 23/02/11 09:04 AM
That's got it. Thanks much for the explanation, hixxy.
Posted By: firefox Re: /run command - 26/02/11 01:52 PM
Originally Posted By: hixxy
You can do this with the wscript.shell COM object:

Code:
alias runex {
  .comopen runex wscript.shell
  if (!$comerr) { .comclose runex $com(runex,run,3,bstr,$1-,int,0,bool,$false) }
}


This completely hides the window, it doesn't just minimise it.

As an added benefit, if you want the script to wait until the program has finished executing before continuing, change "bool,$false" to "bool,$true" smile
thanks hixxy
© mIRC Discussion Forums