0

I am on Windows and in my Inno setup installer I use exec command twice inside separate functions: inside the first one (which is called right at the beginning of the script and I am sure that it works correctly) I install Python:

Exec(ExpandConstant('{app}\python-3.7.4.exe'), '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode)

and inside the second function (which is called in CurStepChanged ssPostInstall step some time after the first function call) I call a script using exec, which is dependent on Python:

Exec('{#Some_Dir}\python-tools\migrate_db.bat', '', '', SW_SHOWNORMAL, ewWaitUntilTerminated, ResultCode)

This second script returns an error of no Python is installed. It behaves like its CMD window was opened before Python installation. Restarting Inno setup installer and skipping the first function makes the second script run correctly.

Why? So I am thinking about something like forcing Inno setup to open completely new CMD window for the second script. Is it possible?

EDIT

The question is not about how does Windows command processor search for commands and why "X is not recognized as an internal or external command...". The question is about how described thing happens in Inno setup when two separate exec commands are called after each other.

Serob_b
  • 965
  • 12
  • 29
  • You have to write the batch file `migrate_db.bat` to query itself the Python installation path from Windows registry as an updated environment variable `Path` is definitely not updated in __local__ environment of already running installation process. Well, you know very well where `python-3.7.4.exe` is installed as defined by you in InnoSetup properties. So you could pass `"{app}\python-3.7.4.exe"` also as argument to batch file `migrate_db.bat` and use this argument inside the batch file. – Mofi Sep 14 '20 at 16:55
  • @MartinPrikryl It seems so. I am trying what's suggested there, and will inform. – Serob_b Sep 15 '20 at 11:50
  • @MartinPrikryl First *SetEnvPath* approach results **complete** removal of my system Path variable also compiled installer is detected as threat by Windows defender; second *RefreshEnvironment* approach makes no effect. **NOTE:** *I call these functions right after Python installation (including adding paths into PATH variable) finished.* – Serob_b Sep 15 '20 at 14:29

0 Answers0