I'm trying to do a qt widgets application and I've got a batch file: containing
@echo off
echo Hello Everyone!
echo ----------------
echo 1 - Exit Program
echo ----------------
echo 2 - Say Hi 5 times
echo ----------------
set /p QUESTION=What would you like to do today?:
echo:
IF %QUESTION%==1 GOTO :1
IF %QUESTION%==2 GOTO :2
:1
exit
:2
cls
echo HI
echo HI
echo HI
echo HI
echo HI
pause
and I would like to pass "2" as an argument to it when its launched using QProcess, like simultaneous with execution
this is my mainwindow.cpp file
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
auto proc = new QProcess();
QString program = QString("\"%1%2\"").arg("C:/Users/firstname secondname/desktop/").arg("mybatchfile.bat");
QStringList arguments;
arguments << "2";
proc->setWorkingDirectory("C:/Users/firstname secondname/desktop/");
proc->start( program, arguments );
}
MainWindow::~MainWindow()
{
delete ui;
}
what I expected is that it runs my batch and shows me hi 5 times but what I get is nothing, I don't get any errors but I don't get desired output
can someone please tell me why that is and how can I fix? I'm really a noob and any feedback would help