postgresqlqtbatch-fileqt-installer

Cannot get .bat file to run after installation with Qt installer


I'm needing to run a bat file when the installer is finished that plugs in a postgres windows service so my database has an active server (I'm using a static postgres). The bat file runs the pg_ctl register command.

According to the Qt Installer Documentation installationFinished is what you use to issue methods that will run once the installer is complete via the controller or package install scripts. I'm not sure if i'm using it correctly because after running the installer the bat file doesnt run. How is this function used properly?

I have tried in the controller script:

Controller.prototype.installationFinished = function(){
    installer.executeDetatched("C:\\Program Files (x86)\\PostgreSQL\\9.6\\pgserv.bat", new Array(), "@homeDir@")
}

also tried in the component install script:

Component.prototype.installationFinished = function(){
component.addElevatedOperation("Execute", "cmd", "/C", "C:\\Program Files (x86)\\PostgreSQL\\9.6\\pgserv.bat");
}

This bat file is to run post install because the command on the bat file requires the postgres\bin folder that is added to the PATH variable after install.

Thanks a lot for any help folks! :)


Solution

  • Try this one:

    Component.prototype.installationFinished = function()
    {
        QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + 
        "/file.bat");     
    }