Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add NSIS script with electron builder to run DPInst.exe during install

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!

like image 864
Tim Avatar asked Oct 15 '25 17:10

Tim


2 Answers

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

!macro customInstall
  ExecWait '"$INSTDIR\resources\DPInst.exe" /sw'
!macroend
like image 138
Tim Avatar answered Oct 19 '25 14:10

Tim


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 
like image 20
Swapnil Patwa Avatar answered Oct 19 '25 13:10

Swapnil Patwa



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!