Inno Setup default install folder change

Mossi picture Mossi · Mar 25, 2013 · Viewed 22.8k times · Source

Every time I compile my installer the default installation directory is C:\Program Files\Company\Product and I don't seem to be able to change it. Here's what I got under Setup:

[Setup]
AppName=MyProduct
AppVerName=MyProduct
AppPublisher=Company
DefaultDirName=C:\MyStuff\Company\MyProduct
DefaultGroupName=Company\MyProduct
UninstallDisplayIcon={app}\MyProduct.exe
UninstallDisplayName=MyProduct Uninstall
PrivilegesRequired=poweruser
OutputDir=userdocs:Inno Setup Examples Output
OutputBaseFilename=Setup
DisableDirPage=false
DisableProgramGroupPage=true
VersionInfoCompany=Company Inc
VersionInfoProductName=MyProduct
AllowUNCPath=false

Based on the documentations, DefaultDirName should dictate the default install folder. But it doesn't.

My case in particular is that, I want to set the default install folder on x64 machines to C:\Program Files, but the installer always picks Program Files (x86) no matter what I put in the DefaultDirName.

Answer

TLama picture TLama · Mar 25, 2013

The last selected installation folder has the precedence before the DefaultDirName directive value if the UsePreviousAppDir directive is set to yes, which is by default. If you want to force the directory specified by the DefaultDirName to be selected, turn off the UsePreviousAppDir directive.

If you want to keep the functionality with the last directory, and just overcome this for your testing, simply uninstall the previous installation before you run the new built setup.