在 CAPL 脚本中调用 sysExecCmd() 后有没有办法关闭终端?

Is there a way to close terminal after calling sysExecCmd() in CAPL script?

我编写了一个 CAPL 脚本,该脚本使用 sysExecCmd 调用 python 脚本,例如 sysExecCmd("python",myParameters,myTree),其中 myTree 是当前(嵌套)工作树 wrt 当前目录CAPL 驻留在 myParameters 在运行时生成并处理某些变量。

问题是:每次调用 sysExecCmd 时,它都会打开一个新终端,并且每个终端都是持久的。我试过在与 sysExecCmd("exit","",myTree) 相同的 myTree 中调用不带参数的 exit 命令,但它没有用(我对它应该有的期望不高)。

虽然问题的解决方案不是这里的中心点(我可以使用变通方法并使用批处理或委托 python 以某种方式关闭终端),但我想知道是否有一种方法可以使用 CAPL 脚本即时关闭终端。

通常,对我来说它是这样工作的:

sysExecCmd("C:\Projects\CANoe\some_script_to_execute && exit","");

&& 退出并不总是有效。

您也可以使用 /c 选项执行此操作。

/c Carries out the command specified by string and then stops.

请注意,我使用的是 sysExec 而不是 sysExecCmd,因为后者使用 /k 选项执行 cmd:

/k Carries out the command specified by string and continues.

snprintf(parameters, elcount(parameters), "/c mkdir %s", directoryName);
result = sysExec("cmd.exe", parameters, workingPath);