2

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! :)

Akism90
  • 43
  • 11

1 Answers1

1

Try this one:

Component.prototype.installationFinished = function()
{
    QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + 
    "/file.bat");     
}
Alexey Tsybin
  • 220
  • 1
  • 6
  • Thanks! That snippet is in the [docs](https://doc.qt.io/qtinstallerframework/qt-installer-framework-openreadme-example.html). I'm just mentioning because i was missing all the code to bind the file to the installationFinished method....as well as using the method incorrectly :s – Akism90 Jul 23 '18 at 06:35