Qt Installer Framework : Syntax for addElevatedOperation (Windows)
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:
Code:
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" ?
Thanks!
Re: Qt Installer Framework : Syntax for addElevatedOperation (Windows)
I tried to modify the line using an external batch file
PrepareDB.bat:
Code:
mysql -uroot -ppassword -e "CREATE DATABASE IF NOT EXISTS dbbase"
and change it in:
Code:
var argList = ["/c","@TargetDir@\\PrepareDB.bat"];
component.addElevatedOperation("Execute","cmd",argList);
but the result is the same...