2

我需要bat在安装程序完成后运行一个插入 postgres Windows 服务的文件,以便我的数据库有一个活动服务器(我使用的是静态 postgres)。该bat文件运行pg_ctl注册命令。

根据 Qt 安装程序文档installationFinished,您可以使用发布方法,一旦安装程序通过控制器或包安装脚本完成,这些方法将运行。我不确定我是否正确使用它,因为运行安装程序后bat文件没有运行。如何正确使用此功能?

我在控制器脚本中尝试过:

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

还尝试在组件安装脚本中:

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

bat文件用于运行安装后,因为该bat文件上的命令需要安装后添加到PATH变量的 postgres\bin 文件夹。

非常感谢大家的帮助!:)

4

1 回答 1

1

试试这个:

Component.prototype.installationFinished = function()
{
    QDesktopServices.openUrl("file:///" + installer.value("TargetDir") + 
    "/file.bat");     
}
于 2018-07-20T12:26:34.243 回答