I have created a simple executable (.exe) file using Inno Setup Compiler 6.0.2 for installing a Windows application.
The .exe file calls a vbscript "Setup.vbs" that unzips "Application.zip" file and updates environment variables.
When I run the .exe file for the first time on a new machine, the .vbs file doesn't get executed. But, from second attempt onwards it works fine. Is this a known issue or is there any solution for this?
Here is the code snippet that I am using to call run .vbs file
[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var ResultCode: integer;
begin
ShellExec('',ExpandConstant('{app}\{#MyAppExeName}'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;
Update
I want the .vbs to execute before the installation. So, I tried ExtractTemporaryFile
, still I am facing the same issue. Not sure what is is wrong with the code below.
#define MyAppExeName "Setup.vbs"
[Files]
Source: "..\Application\Installation_Setup\Setup.vbs"; DestDir: "{app}"; Flags: ignoreversion
[Code]
function PrepareToInstall(var NeedsRestart: Boolean): String;
var
ResultCode: integer;
begin
ExtractTemporaryFile('{#MyAppExeName}');
ShellExec('',ExpandConstant('{app}\{#MyAppExeName}'), '', '', SW_SHOW, ewWaitUntilTerminated, ResultCode)
end;