如何转换以下VBScript代码以与TestComplete中的JScript一起使用?我们正在尝试使用Windows脚本宿主函数而不是TestComplete中的预定义函数来调用application / .exe。

strExe = "C:\whatever\myprogram.exe -h1 -d33"
Set objShell = CreateObject("WScript.Shell")
Set objScriptExec = objShell.Exec(strExe)
strExeOut = objScriptExec.StdOut.ReadAll

最佳答案

这是JScript版本:

var strExe = "C:\\whatever\\myprogram.exe -h1 -d33";
var objShell = new ActiveXObject("WScript.Shell");
var objScriptExec = objShell.Exec(strExe);
var strExeOut = objScriptExec.StdOut.ReadAll();

10-01 04:01