Capturing output from WshShell.Exec using Windows Script Host

后端 未结 5 564
无人及你
无人及你 2020-12-06 11:15

I wrote the following two functions, and call the second (\"callAndWait\") from JavaScript running inside Windows Script Host. My overall intent is to call one command line

5条回答
  •  有刺的猬
    2020-12-06 11:43

    Yes, the Exec function seems to be broken when it comes to terminal output.

    I have been using a similar function function ConsumeStd(e) {WScript.StdOut.Write(e.StdOut.ReadAll());WScript.StdErr.Write(e.StdErr.ReadAll());} that I call in a loop similar to yours. Not sure if checking for EOF and reading line by line is better or worse.

提交回复
热议问题