Window.Run

The Window.Run("cmd_line","dir") function creates a new process and its primary thread:

Here's an example that writes the "ping" output in file:
// File: run.w_js (JScript)
var prId = Window.Run("%comspec% /c ping -n 5 127.0.0.1 > ping.txt","c:\\");
         Window.TextOut(2, 40, 30, "Start processId: " + prId);


function WM_RUN(process_id, exit_code){
         Window.Delete(1);
         Window.TextOut(1,50,50,"process_id: " + process_id);
         Window.TextOut(1,50,70,"exit_code: " + exit_code);
         Window.UpdateWindow();
};
'VBScript run.w_vbs
prId = Window.Run("%comspec% /c ping -n 5 127.0.0.1 > ping.txt","c:\")
Window.TextOut 2, 40, 30, "Start processId: " & prId


Function WM_RUN(process_id, exit_code)
         Window.Delete(1)
         Window.TextOut 1,50,50,"process_id: " & process_id
         Window.TextOut 1,50,70,"exit_code: " & exit_code
         Window.UpdateWindow
End Function
content
The new scripting host. It is not wscript.exe!
JScript and VBScript are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries.