Exec 在 NSIS 安装程序中不起作用 [英] Exec not working in NSIS installer

查看:74
本文介绍了Exec 在 NSIS 安装程序中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是 NSIS 的新手,我试图在安装时执行一个类似于预请求的可执行文件.我尝试了以下代码,将 exe 复制到安装路径,但没有执行.

I am new to NSIS i am trying to execute an executable while installation similar to pre request. I tried the below code which copies the exe to the installation path but it is not executing it.

Section "example" example
  SetOutPath "$INSTDIR"
  File "setup.exe"
  Exec "$INSTDIR\setup.exe"
  BringToFront
SectionEnd 

推荐答案

Seki 的回答大部分是正确的,我只想补充一点,Exec/ExecWait 的正确语法是always Exec '"c:\path\app.exe" param1 "par am2" param3'

The answer from Seki is mostly correct, I'd just like to add that the correct syntax for Exec/ExecWait is always Exec '"c:\path\app.exe" param1 "par am2" param3'

参数当然是可选的,但应用程序的路径应该总是被引用,不仅仅是因为在你的情况下 $INSTDIR 可能包含空格但至少在 Win9x 上它会失败,如果你不引用(根据到 NSIS 手册)

Parameters are of course optional but the path to the app should always be quoted, not just because in your case where $INSTDIR could contain spaces but at least on Win9x it will fail no matter what if you don't quote (According to the NSIS manual)

如果空格/缺少引号不是问题,那么您可能还需要研究其他几件事:

If the spaces/lack of quotes is not the issue then there are a couple of other things you might want to look into:

  • $OUTDIR 是新进程的工作目录(SetOutPath 设置)
  • 缺少 dll 等(检查 进程监视器)

这篇关于Exec 在 NSIS 安装程序中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆