3

I'm using electron-builder to create NSIS Windows installers for my electron app. During install I need to run the included DPInst.exe to make sure drivers get installed.

I can tell electron-builder than I'm including a custom script:

"nsis": {
  "include": "build/installer.nsh"
}

But I can't work out what should be in the installer.nsh

The docs say that I need something like:

!macro customInstall
  !system "echo '' > ${BUILD_RESOURCES_DIR}/customInstall"
!macroend

And I've seen some NSIS commands to run DPInst.exe

ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'

But I'm unsure how to combine them as I can't work out the syntax!

Tim
  • 7,746
  • 3
  • 49
  • 83

2 Answers2

4

Well, it was pretty obvious ‍♂️. I just had to combine the two:

!macro customInstall
  ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'
!macroend
Tim
  • 7,746
  • 3
  • 49
  • 83
1

For me, ExecWait '"$INSTDIR\resources\DPInst.exe" /sw' alone wasn't working because of permission issues.

I had to add RequestExecutionLevel admin

installer.nsh looks like -

!macro customHeader
    RequestExecutionLevel admin
!macroend
!macro customInstall   
  ExecWait '"$INSTDIR\ABC_Setup.exe" /sw'
!macroend 
Swapnil Patwa
  • 4,069
  • 3
  • 25
  • 37
  • After adding this still its not installing my script:- https://ankurt.tinytake.com/tt/NTQxMjM2NF8xNjkyNjk2Mw – Ankur Tripathi May 20 '21 at 11:13
  • @AnkurTripathi see https://nsis-dev.github.io/NSIS-Forums/html/t-212645.html for msi. The above solution worked for me for executable file. I haven't tried msi yet. – Swapnil Patwa May 20 '21 at 15:55