inno-setup

Create files in Inno Setup setup needed by the [Files] section


In my Inno Setup script, I need to execute a command that generates temp files that are to be copied in the [Files] section. I have tried the following:

; cd to the directory of the Inno Setup script and execute a python file
#expr Exec('cmd /C "cd /d %cd% & C:\Python34\python.exe run.py"','','',1,SW_HIDE)

This does not seem to execute as I do not see the files created, which can obviously not be included in the installer.

Along the same lines, how would I execute a command when complete to delete these temp files?

Edit I did execute the cmd by hand and validated that it works


Solution

  • It should be:

    #expr Exec('cmd.exe', '/C "cd /d %cd% & C:\Python34\python.exe run.py"','',1,SW_HIDE)
    

    The cmd.exe is the process you are executing, the rest are arguments.

    Though even better would be to do without cmd.exe as you do not need it actually:

    #expr Exec('C:\Python34\python.exe', 'run.py','c:\startupfolder',1,SW_HIDE)
    

    See Inno Setup Preprocessor: Exec.


    Though personally, I'd create a batch file that first runs the Python and then runs Inno Setup compiler. It's way easier and more understandable.