This will initiate a command console (hidden) that will execute the command that you specified, and will signal the event "cmd" when all output from your command has been received. The output is stored in file cmd.txt. Btw, you should have just said what you wanted to do exactly (what commands are you trying to perform?), because if this was for let's say to redirect output from netstat.exe or ping.exe etc you dont' need the command prompt for that.

Code:
alias cmd {
  if (!$0) return
  var %wsh = wsh $+ $ticks 
  .comopen %wsh wscript.shell
  .comclose %wsh $com(%wsh,run,1,bstr*,% $+ comspec% /c $1- >cmd.txt,uint,0,bool,true)
  .signal cmd $1-
}
 [color:red]  [/color] 
on *:signal:cmd:{
  echo -a Finished executing command: $1-
}


The reason for the signal is that the alias /cmd will be halted until all the output is returned, so the code after the line that says .comclose (in our case signal) could be executed a few seconds after you issued /cmd, since it waits.


Gone.