Vijay Vennapusa
Vijay Vennapusa

Reputation: 179

Install application using Inno Setup to a folder with current user name in its path (user profile)

I am creating an exe file with Inno Setup 5 compiler. I want to place the application by default at this location:

C:\users\username\AppData\local\appname

How can I get the user's Windows username?

with some kind of keyword like

C:\users\%AppData%\local\appname

or something that I could add in the script?

Upvotes: 3

Views: 4164

Answers (2)

mirtheil
mirtheil

Reputation: 9192

Typically I use the constant {userappdata} as described in the documentation to represent the %AppData% Windows constant which maps to c:\users\username\AppData\Roaming.
For example:

[Files]
Source: "c:\Build\output\test.dta"; DestDir: "{userappdata}\MyApplicaton\Data"; Flags: ignoreversion

Upvotes: 3

Uga Buga
Uga Buga

Reputation: 1784

According to InnoSetup docs the {%username|DefaultValue} can be used to get the username from environment variables. Keep in mind that the username and the name of the user folder can be different (as it is on my machine).

Upvotes: 1

Related Questions