John Carpmael
John Carpmael

Reputation: 149

How to create a destname which includes date and time at installation in Inno Set-up

I want to use the [Files] section to create a new file which has the format:

Program Name plus date plus time .fmpur

I'd be grateful for any ideas.

Upvotes: 5

Views: 2504

Answers (2)

T.S
T.S

Reputation: 363

An alternative to TLama's example using a function to get the filename.

[code]
function GetFileName(Dummy: String): String;
begin
    Result := SetupSetting("AppName") + " " + GetDateTimeString('dd-mm-yyyy hh-nn-ss', '-', ':') + ".fmpur";
end;

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; DestName: "{code:GetFileName}"

Upvotes: 0

TLama
TLama

Reputation: 76733

For instance the following way. How to modify a date time pattern, see the GetDateTimeString page:

[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program

#define FileNamePattern SetupSetting("AppName") + " " + GetDateTimeString('dd-mm-yyyy hh-nn-ss', '-', ':') + ".fmpur";

[Files]
Source: "MyProg.exe"; DestDir: "{app}"; DestName: "{#FileNamePattern}"

Upvotes: 6

Related Questions