Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

Run a [Code] or PowerShell script in Inno Setup compiler

Is there a way to run a [Code] procedure or PowerShell script in the Inno Setup compiler before the installation executable is generated?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You may get better answers, if you explain what you need to run the code for. Anyway...


One way is to compile the script on command-line from a batch file:

powershell -file precompile.ps1

ISCC.exe setup.iss

powershell -file postcompile.ps1

(or you can call ISCC.exe from the PowerShell script itself)


Another way to run some script before compilation is using Exec preprocessor function.

#expr Exec("precompile.bat")

or

#expr Exec("powershell -file precompile.ps1")

See also Is it possible to call a batch file while compiling an Inno Setup script?


If you need a GUI solution, there's ISTool, an Inno Setup extension, that has direct support for Pre Compilation and Post Compilation "Steps". But this project is unfortunately no longer maintained. You might be able to update it to the latest Inno Setup version, as it is open source.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...