Aashu10
23rd November 2015, 11:55
i want to run a bacth file from QT, currently i have code something like given below. i want to run on cmd is somthing like
startup.bat -arg1=abc -arg2=abc1 -arg2=abc3 -arg4=abc4
how do i run the batch file with arguments? any help will be appriciated
void MainWindow::on_Button_Go_clicked()
{
QProcess cmd;
const QString myProc = "cmd.exe /c startup.bat " + MainWindow::getWorkingConfiguration(); QString sOldPath = QDir::currentPath();
QString myPath= MainWindow::getWorkingDirectory();
QDir::setCurrent( myPath );
//Run it!
cmd.startDetached(myProc);
qDebug(myPath.toStdString().c_str());
QDir::setCurrent( sOldPath );
}
startup.bat -arg1=abc -arg2=abc1 -arg2=abc3 -arg4=abc4
how do i run the batch file with arguments? any help will be appriciated
void MainWindow::on_Button_Go_clicked()
{
QProcess cmd;
const QString myProc = "cmd.exe /c startup.bat " + MainWindow::getWorkingConfiguration(); QString sOldPath = QDir::currentPath();
QString myPath= MainWindow::getWorkingDirectory();
QDir::setCurrent( myPath );
//Run it!
cmd.startDetached(myProc);
qDebug(myPath.toStdString().c_str());
QDir::setCurrent( sOldPath );
}