Search code examples
nsisfilepathuninstallation

NSIS Embed Uninstaller readRegStr Filepath


I have an uninstaller created with HM NIS Edit. And as of now it is executing the uninstaller from a static path. But I want to make it dynamic. It has to read the reg and then uses that path as a prefix for to find the uninstaller.

readRegStr $0 HKLM "SOFTWARE\Data Access Worldwide\Visual DataFlex\17.0\Defaults" VDFRootDir

I hope I made myself clear.


Solution

  • You can join strings with StrCpy:

    ReadRegStr $0 HKLM "SOFTWARE\Data Access Worldwide\Visual DataFlex\17.0\Defaults" VDFRootDir
    StrCpy $0 "$0\Uninstall Visual DataFlex 17.0.22.0\UNWISE.EXE"
    ExecWait '"$0"'
    

    You don't even need StrCpy if you only use the string once:

    ReadRegStr $0 HKLM "SOFTWARE\Data Access Worldwide\Visual DataFlex\17.0\Defaults" VDFRootDir
    ExecWait '"$0\Uninstall Visual DataFlex 17.0.22.0\UNWISE.EXE"'