Archive: NSIS - Control folder location in Start-Menu


NSIS - Control folder location in Start-Menu
Hi,

I have done NSIS script that performs silent installations on several setup files (.exe).

They end up on different default locations/folders in the Start menu, since I have not specified where to place them, and I don't know how.

The reason is that some of these installed programs are pointless to have as stand-alone programs, as they depend on the "Main" installed program to run.

So, what I want to do is to control, in the NSIS script, that some of the program folders are placed inside/under the "MAIN"-program folder in the Start-menu.

How do I do this? Is it possible?

BR
Carolus


You can either just delete those short cuts and then create your own after running the silent installers, or just move them using Rename. You can just move the entire folders under your own.

Stu


Hi,

Thanks for your reply.

Could you please show an example of this?

I tried to 'move' som program folders using createshortcut, but that doesn't work.

BR,
Carolus


As I said, use the Rename instruction. You can move files and folders using it.

Stu


Hi,

Thanks.

I am of course doing somehting wrong, it doesn't work.

I tried, after the silent installation calls (ExecWait....) on one of the 'sub-apps' with this:

; There is a space in MikTex 2.9 folder name
Rename "$SMPROGRAMS\MikTex 2.9" "$SMPROGRAMS\doxygen\MikTex 2.9"

; Also tried to remove the directory entirely
RMDir /r "$SMPROGRAMS\MikTex 2.9"

The creation of the installation .exe works and the installation goes through, but the folder is NOT moved, or deleted in the latter case.

BR,
Carolus


Are you sure you're in the proper user context? SetShellvarContext all or current? Also, if current, are you at the proper access level (elevated/admin vs userlevel)?

Put a MessageBox MB_OK "$SMPROGRAMS" in front of your delete command to see which path you're actually trying to delete.


Hi,

Thanks.

You are abolutely right. I have only tried the delete command so far.

I copy-pasted the path in the delete command:
RMDir /r "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\MikTex 2.9"

And that worked. But that does not look very elegant though. How should it be if I want to use some pre-defined path constant and delete the same directory, in the correct context?

BR,
Carolus


As MSG said you need to use SetShellvarContext all to change the context of the path constants (that path is for all users, so use all).

Stu