I made an installer, let say InstApp1
InstallDir "C:\Path1"
For a new version of installer i made this:
Copied (Select All->CTRL+C) old installer instructions;
generate a new NSIS file, "Paste" in it instructions.
Modified what i need..Version and PATH:
InstallDir "C:\Path2".
Saved
generate installer, launch.
No metter on what PC launch installer, the default path still remain "C:\Path1".
Why happend this?
"C:\Path1" not found in NSIS source of second installer.
Default Install folder
10 posts
InstallDirRegKey?
What system are you on?
NSIS is installed about 3 years on XP SP3. And working well.
Installer tested on W7-64, XPSP3, W10-64..
On both the same wrong default install dir.
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\LaunchPRG.exe"
Section -Post
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\LaunchPRG.exe
Installer tested on W7-64, XPSP3, W10-64..
On both the same wrong default install dir.
InstallDirRegKey HKLM "${PRODUCT_DIR_REGKEY}" ""
!define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\LaunchPRG.exe"
Section -Post
WriteUninstaller "$INSTDIR\Uninstall.exe"
WriteRegStr HKLM "${PRODUCT_DIR_REGKEY}" "" "$INSTDIR\LaunchPRG.exe
The key path and/or name used in InstallDirRegKey must be different for different products because it overrides $InstDir set by InstallDir before .onInit.
Comment out the InstallDirRegKey line and see if that fixes the issue.
Comment out the InstallDirRegKey line and see if that fixes the issue.
[...]
I will try to comment the line and i will tell you.
I saw now: If installed first version and not uninstalled, this key remain and became next Installdir...
I will erase the line.
Thank you
I will try to comment the line and i will tell you.
I saw now: If installed first version and not uninstalled, this key remain and became next Installdir...
I will erase the line.
Thank you
Ideally you should point InstallDirRegKey to your applications unique Uninstall entry.
Please, more. You "lost" me.
Anyway, i commented the line as you told me and the default install path is showed correctly.
Anyway, i commented the line as you told me and the default install path is showed correctly.
You probably already know this, but what @Anders was saying:
If your installer adds the uninstaller to the Add/Remove Programs (e.g., in reg key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LaunchPRG)
...then you would already be doing this on a new install:
Since you have to set that value anyway for the uninstaller, you should just use that for your upgrades:
If your installer adds the uninstaller to the Add/Remove Programs (e.g., in reg key HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LaunchPRG)
...then you would already be doing this on a new install:
[Which is what he meant by "applications unique Uninstall entry."]WriteRegStr HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LaunchPRG" "InstallLocation" "$\"$INSTDIR$\""
Since you have to set that value anyway for the uninstaller, you should just use that for your upgrades:
You want to ensure the directory still exists before treating it as an upgrade. And of course you would make sure your uninstaller deletes that key.InstallDir "$PROGRAMFILES64\LaunchPRG" # set default
InstallDirRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\LaunchPRG" "InstallLocation" # get path for upgrade
Understud now. Thank you.