electron builder nsis在安装期间运行其他可执行文件

electron builder nsis在安装期间运行其他可执行文件,electron,nsis,electron-builder,Electron,Nsis,Electron Builder,在安装我的应用程序期间,我试图运行不同的可执行文件,但找不到正确的路径。该程序添加了以下electron builderconfig: extraFiles: - from: tools/tapinstall/${arch}/ to: resources/tapinstall/ filter: - "**/*" 安装我的应用程序后,我可以看到resources/tapinstall/文件夹中的文件,因此它正在被移植。现在,在我

在安装我的应用程序期间,我试图运行不同的可执行文件,但找不到正确的路径。该程序添加了以下
electron builder
config:

extraFiles:
    -   from: tools/tapinstall/${arch}/
        to: resources/tapinstall/
        filter:
            - "**/*"
安装我的应用程序后,我可以看到
resources/tapinstall/
文件夹中的文件,因此它正在被移植。现在,在我的
nsis
installer.nsh
中,我添加了
ExecWait
指令,从该目录运行
exe
,但失败了

作为一种不顾一切的措施,我认为在所有东西前面加上
$INSTDIR
不是正确的做法,可能路径不是
$INSTDIR
和其他一些东西,我发现了3个可能的候选者:

  • $INSTDIR
  • $APPDATA
  • $BUILD\u RESOURCES\u DIR
我添加了以下简单代码,以查看创建了哪个文件,以便找出要使用的正确宏:

!macro customHeader
    RequestExecutionLevel admin
!macroend

!macro customInstall
    !system "echo 'as' > $INSTDIR/customInstall"
    !system "echo 'bs' > $APPDATA/customInstall"
    !system "echo 'cs' > $BUILD_RESOURCES_DIR/customInstall"

    ${ifNot} ${isUpdated}
        !system "echo 'a' > $INSTDIR/customInstall"
            !system "echo 'b' > $APPDATA/customInstall"
            !system "echo 'c' > $BUILD_RESOURCES_DIR/customInstall"
    ${endIf}
!macroend
然后我在我的电脑上搜索了一个名为
customInstall
的文件,什么都没有。我做错了什么?

!系统
(以及所有其他!指令)在编译时在makensis.exe内执行。您不能在编译时访问变量/常量,只能访问定义和环境变量

!define foo "Hello"
!warning "${NSISDIR} & $%Temp% & ${foo}"

Var Bar
Section
StrCpy $Bar "World"
MessageBox mb_ok "$InstDir & $Bar"
SectionEnd