How to get path, where the InnoSetup script file you are currently compiling is located ?
Inno Setup is a free software script-driven installation system created in Delphi by Jordan Russell. The first version was released in 1997.
Go to Menu, Project, then Compile to compile and create the setup file. This will create a complete installer. Run the Setup and your application will be installed correctly. Innosetup offers an awesome alternative to create great looking Installers for free.
Inno Script Studio is a new intuitive graphical interface for generating and compiling scripts for the award winning Inno Setup compiler from Jordan Russell.
Inno Setup's [Code] section uses Pascal (or Pascal Script to be more exact, thanks to TLama), likely because Inno Setup itself is written in Pascal Delphi.
To get script source path, use the preprocessor's predefined variable SourcePath
. That variable you can expand in your script as an ordinary define
. In case, the script was not yet been saved, it returns path to My Documents
directory. Here's just a useless example to test:
[Setup]
AppName=My Program
AppVersion=1.5
DefaultDirName={pf}\My Program
[Code]
procedure InitializeWizard;
begin
MsgBox(ExpandConstant('{#SourcePath}'), mbInformation, MB_OK);
end;
Don't forget that you have to compile the script (CTRL + F9) not only run (F9) to invoke preprocessor to rebuild the script.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With