InstallDirRegKey only reads from the registry, it never writes.
Before your .onInit
is executed NSIS does:
- If
InstallDir
is set, that path is copied to$Instdir
- If
InstallDirRegKey
is set and the registry key exists, the path from the registry (With the filename removed) is copied to$Instdir
So if you want InstallDirRegKey to have any effect the next time a user runs the installer you must point it to a key that your installer creates in one of your sections. It can be the UninstallString command in your uninstall key or a application specific key like HKLM\Software\My Company\My App
.
The whole point of this is that when the user re-installs or installs a new version of your app it will be installed in the same folder (overwriting/upgrading the existing install).