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()
{
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
);
}
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 );
}
To copy to clipboard, switch view to plain text mode
Bookmarks