Question and Answer
Question and Answer

Reputation: 83

How to add a default folder always with target installation using NSIS

I want to append a default directory to my INSTALL directory always internally. I have set it by default but if user change the directory then it not works and installed the files in the folder that user selected.

So I need append a folder ( Product name ) always internally and it can be append with the user's selected path.

Like if user selected "C:\Program Files\My Folder" then the installation should be in path "C:\Program Files\My Folder\ProductName" Should work with the silent as well. Can someone please advise on this.

Upvotes: 0

Views: 673

Answers (1)

Anders
Anders

Reputation: 101569

Section MyFirstSection
StrCpy $InstDir "$InstDir\ProductName" ; Force extra sub-directory
; ...
SectionEnd

However, the recommended way to do this is to just use InstallDir without a ending backslash:

Note that the part of this string following the last \ will be used if the user selects 'browse', and may be appended back on to the string at install time (to disable this, end the directory with a \ (which will require the entire parameter to be enclosed with quotes).

Upvotes: 1

Related Questions