Example (for v2):
Code: Select all
shell := ComObjCreate("WScript.Shell")
exec := shell.Exec(A_ComSpec " /Q /k echo off")
commands := "
(
echo doing some stuff.
echo doing some more stuff...
echo all done!
exit
)"
exec.StdIn.WriteLine(commands)
MsgBox % exec.StdOut.ReadAll()
I posted a v1 version of this and another example
here.
I'll add something like this to the help file.
RunWait, %ComSpec% /c ping 127.0.0.1, <PIDvar>, <outputVAR>
Firstly, you seem to have omitted the WorkingDir and Max|Min|Hide|UseErrorLevel parameters which come before OutputVarPID. Secondly, OutputVarPID itself is pretty useless for RunWait - you have to use it from another thread, since by the time RunWait returns, the PID is invalid. That being the case, it would make sense to replace OutputVarPID with OutputVarOutput.
If someone really needs the PID, they can use Run and then ProcessWaitClose.
Also, since this is the v2 forum, you presumably mean %A_ComSpec% rather than %ComSpec%.