Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt IFW access file name of installer exe



  • I have an installer that contains a unique ID in its file name. For example, "my-installer-123456.exe". Is there a way to read the original file name during the installation?
    I could not find anything in the Scripting API.



  • There is a predefined variable "InstallerFilePath" to solve my issue.

    installer.value("InstallerFilePath");
    

    During my search I came across other interesting solutions. For example, you can also list all running processes and then search for your own name via RegEx. Maybe this approach is also interesting for somebody.

    // list the names of all running processes
    var outputArr = installer.execute('cmd.exe', ['/C', 'wmic process get name']);
    var id = "";
    if(outputArr.length == 2) {
      // match the name of "my-installer-123456.exe" and extract the numerical id
      id = outputArr[0].match(/my\-installer\-(\d+)/i)[1];
    }
    


  • @Christoph-Schaefer

    This is merely a user forum and responses to IFW are rather scarce. With such a deep-inside question you might have better chances with the Qt developer's mailing list.



  • There is a predefined variable "InstallerFilePath" to solve my issue.

    installer.value("InstallerFilePath");
    

    During my search I came across other interesting solutions. For example, you can also list all running processes and then search for your own name via RegEx. Maybe this approach is also interesting for somebody.

    // list the names of all running processes
    var outputArr = installer.execute('cmd.exe', ['/C', 'wmic process get name']);
    var id = "";
    if(outputArr.length == 2) {
      // match the name of "my-installer-123456.exe" and extract the numerical id
      id = outputArr[0].match(/my\-installer\-(\d+)/i)[1];
    }
    

Log in to reply