Archive: Silent Installs - how to change StartMenuGroup and InstallDir programmatically?


Silent Installs - how to change StartMenuGroup and InstallDir programmatically?
I've added silent support (with a record option) to my NSIS installers and the only thing I'm having problems with is the correct way to read/save the default Start Menu group and Installation directory.

I'm using the MUI2 theme, and its dialogs are handling both of these pages - but can't see where its reading/saving these values. What variables should I be changing?

Cheers in advance!


The MUI directory page copies the picked folder path into the $INSTDIR variable.
The MUI Start Menu page copies the picked start menu path into the variable you specify in the '!insertmacro MUI_PAGE_STARTMENU ID Variable' line.

So you would manually copy appropriate values into those two variables when detecting a silent installation.


Thanks for your reply.

I actually managed to figure out the $INSTDIR variable after a bit of trial and error, but the StartMenuGroup eludes me still.

The variable I'm passing to that macro is $StartMenuGroup - seems simple enough, but when I read that value I get something completely different than I expected - it's a path like C:\Users\XXX\AppData\Roaming\xxx\StartMenu\ (sorry, not at work atm and don't remember the full path, but it seemed more like the path TO the StartMenu group and not the name specified by the user.


The value stored in the $StartMenuGroup is actually the full path to the user's Start Menu + the start menu entry (which gets stored as another folder). So when you run it in silent mode, you will have to append an appropriate start menu entry to that path yourself.