Announcement

Collapse
No announcement yet.

Unable to read variables from INI file during silent intallation

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Unable to read variables from INI file during silent intallation

    I am trying to give my customer a silent installer. He will provide the correct .INI file based on his user's needs. The joe.ini file sets a single variable:

    [SetupValues]
    %INSTALLSPID%=valueFromIniFileForTesting

    In a command shell, I run: Pimm_4.4.0.0.exe /S:joe.ini

    However, I always set the default value for this variable, no matter how I try to run it. I added this code to my installer to debug, and it verifies that the INI file has no impact. How do I fix this?

    My startup code:
    local installSPID = SessionVar.Expand("%INSTALLSPID%");
    if _SilentInstall then
    SetupData.WriteToLogFile("Info\tThe setup is running silently\r\n", true);
    else
    SetupData.WriteToLogFile("Info\tThe setup is running interactively\r\n", true);
    end
    SetupData.WriteToLogFile("Info\tThe spid is set to: "..installSPID.."\r\n", true);
    local sArgs = "";
    for i,v in pairs(_CommandLineArgs) do
    sArgs = sArgs .. v .. " ";
    end
    SetupData.WriteToLogFile("Info\tCommand line args: " .. sArgs .. "\r\n", true);
    Application.Exit(0);

    From the log file:

    [01/11/2019 11:57:05] Notice Start project event: On Startup
    [01/11/2019 11:57:05] Info The setup is running silently
    [01/11/2019 11:57:05] Info The spid is set to: DEFAULT
    [01/11/2019 11:57:05] Info Command line args: C:\Users\Steve\AppData\Local\Temp\_ir_sf_temp_20\i rsetup.exe /S:joe.ini __IRCT:2
    [01/11/2019 11:57:05] Success Run project event: On Startup

    Thanks for any help.
    Attached Files

  • #2
    Try this:

    1) I always define the Session Variable, which should be set via INI file, in the project settings first. I do not see a "INSTALLSPID" there, so I added it there:

    Click image for larger version

Name:	SCRN-2019-01-12-02.png
Views:	138
Size:	11.4 KB
ID:	302412

    2) It is required to pass the full path to the INI file, not only its name. The installer is executed from the TEMP folder after decompression, and the INI file is not in the current folder.You can of course process the command line arguments by yourself via Lua script (and set the Session Variables accordingly), but if you want to use the provided mechanism, you need to point to the full path. Instead of invoking
    Code:
    Pimm_4.4.0.0.exe /S:joe.ini
    you may want to try again with

    Code:
    Pimm_4.4.0.0.exe /S:"D:\foldername with spaces\joe.ini"
    Ulrich

    Comment

    Working...
    X