Exec not working in NSIS installer

大憨熊 提交于 2019-12-14 01:39:06

问题


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 

回答1:


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'

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 is the working directory for the new process (SetOutPath sets this)
  • Missing dll's etc (Check with Process Monitor)



回答2:


Do the $INSTDIR variable maps to a directory whose name contains spaces? If so, you should add simple quotes to include the double quotes into the Execargument :

Exec '"$INSTDIR\setup.exe"'


来源:https://stackoverflow.com/questions/10897271/exec-not-working-in-nsis-installer

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!