View Full Version : Qt Installer Framework : Syntax for addElevatedOperation (Windows)

9th February 2021, 15:32
Hello to everybody,
I have a problem with installscript.js in Qt Installer Framework.

I need to create a mysql database using the command:
mysql -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS dbbase"
so I add this line in installscript.js:

component.addElevatedOperation("Execute", "cmd","/C","mysql","-uroot","-ppassword", "-e", "\"CREATE DATABASE IF NOT EXISTS dbbase\"");

if I launch this command from terminal, all works correctly.
On the other hand, during installation process, I have this error message:

Error during installation process (mariadb.com): Execution failed(Unexpected exit code: 1):"cmd /C mysql -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS dbbase""

In other parts of code the call of "Execute" doesn't cause any problem... perhaps it could be a syntax error "-e", ""CREATE DATABASE IF NOT EXISTS dbbase" ?


10th February 2021, 07:19
I tried to modify the line using an external batch file


mysql -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS dbbase"

and change it in:

var argList = ["/c","@TargetDir@\\PrepareDB.bat"];

but the result is the same...