[SCRIPT] Check whether Windows is 64-bit or 32-bit [INNO]

Inno Setup Discussion
User avatar
niTe_RiDeR_Pr0
Posts: 62
Joined: Wed Apr 13, 2016 9:15 am
Location: $omewhere in the Un!verse
Has thanked: 34 times
Been thanked: 61 times

[SCRIPT] Check whether Windows is 64-bit or 32-bit [INNO]

Postby niTe_RiDeR_Pr0 » Mon Apr 18, 2016 6:22 am

This is an easy way to check whether Windows x86 or x64 before doing something, in Inno Setup.

Example Script:

Code: Select all

[Files]:
Source: ".\something-x86.exe"; DestDir: "{app}"; Components: "somethingelse-x64"
Source: ".\something-x64.exe"; DestDir: "{app}"; Components: "something-x64"
Source: ".\something.exe"; DestDir: "{app}"; Components: "something"
Source: ".\x64\myfile.exe"; DestDir: "{app}"; Check: "IsWin64"
Source: ".\x86\myfile.exe"; DestDir: "{app}"; Check: "not IsWin64"
Source: ".\myfile-x86.exe"; DestDir: "{app}"; Check: "not IsWin64"
Source: ".\myfile-x64.exe"; DestDir: "{app}"; Check: "IsWin64" 
Source: ".\driver-x86.inf"; DestDir: "{app}"; Tasks: "x86-driver"
Source: ".\driver-x64.inf"; DestDir: "{app}"; Tasks: "x64-driver"
Source: ".\run64.exe"; DestDir: "{app}";
Source: ".\run32.exe"; DestDir: "{app}";
 
[Components]
Name: "something-x86"; Description: "Something for x86"; Check: "not IsWin64"
Name: "something-x64"; Description: "Something for x64"; Check: "IsWin64"
Name: "something"; Description: "Something for both";

[Tasks]
Name: x86-driver; Description: "Install 32-bit driver"; Check: "not IsWin64"
Name: x64-driver; Description: "Install 64-bit driver"; Check: "IsWin64"

[Run]
Filename: "{app}\run32.exe"; Description: "Running..."; Check: "not IsWin64"
Filename: "{app}\run64.exe"; Description: "Running..."; Check: "IsWin64"
Filename: "{app}\myfile.exe"; Flags: postinstall; Description: "Launch myfile"

here, you dont have to add code section. not IsWin64 refers to x86 & IsWin64 refers to x64. You can add Check: "IsWin64" & Check: "not IsWin64" to [Registry] Section lines also.

Tip: This option is also available by default in Inno Script Studio.

Cheers & Regards ;)
Image Image

Return to “Inno Setup”

Who is online

Users browsing this forum: No registered users and 1 guest