Search code examples
inno-setupwsh

cscript.exe launched by inno setup installer says cannot find file while it is right there


In my Inno setup script, I have this line:

[Files]
Source: "C:\my.vbs"; DestDir: "C:\folder"; Flags: ignoreversion
[Run]
Filename: "cscript.exe C:\folder\my.vbs"; Description: "{cm:LaunchProgram,my}"; Flags: nowait postinstall skipifsilent runascurrentuser

but when the the installation is finished, it pop up an error saying: Unable to execute file: cscript.exe C:\folder\my.vbs Create process failed; code 2. the system cannot find the file specified.

When I go to C:\folder, the my.vbs is right there, why would it say it can't find the file?


Solution

  • The Filename parameter, as the name says, is a path to a (executable) file to execute. What in your case is cscript.exe.

    The rest are parameters of that executable, which go to the Parameters parameter.

    [Run]
    Filename: "cscript.exe"; Parameters: "C:\folder\my.vbs"; \
        Description: "{cm:LaunchProgram,my}"; \
        Flags: nowait postinstall skipifsilent runascurrentuser