[英]How to execute a command from a certain directory in Inno Setup script
I have multiple cmd
commands which is about installing npm
components.我有多个关于安装npm
组件的cmd
命令。 I don't want to use batch file for this purpose.我不想为此使用批处理文件。 How can I execute these commands through Exec
function in an Inno Sectum script and I want the installer to wait until these commands get executed?如何通过 Inno Sectum 脚本中的Exec
函数执行这些命令,并且我希望安装程序等到这些命令被执行?
Here are some example commands I wish to execute also they need to be executed on specified directory:以下是我希望执行的一些示例命令,它们也需要在指定目录上执行:
npm install forever-monitor
npm install ip
Inno Setup Exec
function takes WorkingDir
as the third parameter. Inno Setup Exec
函数将WorkingDir
作为第三个参数。
So you can do所以你可以做
Exec('npm', 'install forever-monitor', ExpandConstant('{pf}\nodejs'),
SW_HIDE, ewWaitUntilTerminated, ResultCode);
Though in this case, I would question, whether npm
really needs to be executed from its directory.虽然在这种情况下,我会质疑, npm
是否真的需要从其目录中执行。 It is likely, that all you actually need is to execute npm
with a full path:很可能,您实际需要的只是使用完整路径执行npm
:
Exec(ExpandConstant('{pf}\nodejs\npm'), 'install forever-monitor', '',
SW_HIDE, ewWaitUntilTerminated, ResultCode);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.