使用 运行() 启动的程序无法找到其配置文件

Program started using Run() is unable to locate its config file

如果我从 cmd 提示 运行 c:\myfile.exe 它工作并正确加载其配置文件。但是同样的事情使用 AutoIt 启动了程序,但随后忽略了它的配置文件:

Run("c:\myfile.exe")

为什么它 运行 不像在 cmd 提示符下那样正确?

Helpfile shows:

Run ( "program" [, "workingdir" [, show_flag [, opt_flag]]] )

设置 "workingdir"(配置文件的路径)。您的 "program" 在工作目录中搜索其配置文件。它默认为 AutoIt 脚本的工作目录,等于 @ScriptDir.

按照你的例子,应该是:

Run("C:\myfile.exe", "C:\")

运行 从 cmd 中而不是直接执行它是否会导致预期的行为?

Run("cmd /c c:\myfile.exe")

Run(@ComSpec &  " /c c:\myfile.exe")