I'm trying to open a server via batch file in cmd.exe in my Qt application. Despite I'm using QProcess::startDetached() to start the command line it closes immediately after start. The server is starting, but instead of "serving" the process is killed. Here is my code:
void DICOMReceiver::startReceiver()
{
QProcess receiver;
boost::filesystem::path dbDir = boost::filesystem::absolute(databaseDirectory.toStdString());
receiver.startDetached("cmd.exe", QStringList() << "/c" <<
"dcmrcv.bat" << "AETitle:11112" << "-dest " << dbDir.string().c_str());
receiver.waitForStarted();
}
When I run the batch file manually in the cmd.exe it is working as desired. Does anybody have an idea how to keep the process running so that I can use the server?