NSIS - Change $INSTDIR to a custom path
See original GitHub issueElectron Builder - 19.22.1
Target - NSIS
I’m trying to change the default installation directory to custom(Ex: C:\MyApp) and remove default(C:\Program Files\MyApp). package.json
{
"win": {
"target": "NSIS",
"icon": "build/icon.ico"
},
"nsis": {
"oneClick": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"createDesktopShortcut": true,
"include": "build/installer.nsh"
}
}
I used !macro preInit, but didn’t work: build/installer.nsh
!macro preInit
StrCpy $INSTDIR "C:\MyApp"
!macroend
error
command StrCpy not valid outside Section or Function
It is possible to change default installation do C:\MyApp even if installer have only in elevation mode?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Change the default install folder in NSIS - Stack Overflow
But currently the automatic installation path is set as follows in the installer. C:\Program Files (x86)\myapplication. The installer script ...
Read more >Path Manipulation - NSIS - SourceForge
Warning : this code will replace paths rather than append if the existing path exceeds the maximum string length in the NSIS build...
Read more >How to select the installation directory? - NSIS Forums
I have tried with sample code with same 'Page Directory'. But in this case it is promptly asking the user for installation path....
Read more >How to change installation directory path with command line ...
I want to silently install NSIS in D:\VLC. I can do that with old ... Old VLC installer can change installation directory with...
Read more >NSIS - electron-builder
PORTABLE_EXECUTABLE_APP_FILENAME - sanitized app name to use in file paths. Common Questions¶. How do change the default installation directory to custom?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@hemavidal @develar Just letting you know guys: This would make autoUpdate always install to “C:\MyApp” (or your designated default dir) It happens on electron-builder 20.4.1.
Steps to reproduce:
I resolved with this: