Inno Setup: copy folder, subfolders and files recursively in Code section

To recursively copy a directory programmatically use: procedure DirectoryCopy(SourcePath, DestPath: string); var FindRec: TFindRec; SourceFilePath: string; DestFilePath: string; begin if FindFirst(SourcePath + ‘\*’, FindRec) then begin try repeat if (FindRec.Name <> ‘.’) and (FindRec.Name <> ‘..’) then begin SourceFilePath := SourcePath + ‘\’ + FindRec.Name; DestFilePath := DestPath + ‘\’ + FindRec.Name; if FindRec.Attributes and … Read more

Make Inno Setup installer request privileges elevation only when needed

Inno Setup 6 has a built-in support for non-administrative install mode. Basically, you can simply set PrivilegesRequiredOverridesAllowed: [Setup] PrivilegesRequiredOverridesAllowed=commandline dialog Additionally, you will likely want to use the auto* variants of the constants. Notably the {autopf} for the DefaultDirName. [Setup] DefaultDirName={pf}\My Program The following is my (now obsolete) solution for Inno Setup 5, based on … Read more