I need to write a program that will call a process and a command in it, and put the result in a separate file, I wrote the program itself, but it gives an error: "Error. Using the "path" construction:the template "with the /R parameter is unacceptable.". The trick is that the command works in cmd and does not issue any errors, and if I call the command via QProcess, then there is always an error. I'm using Qt5.
#include <QCoreApplication>
#include <QProcess>
#include <QString>
void getPathToFile(QString fileName);
int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QProcess splitter;
QString fileName = "Bones";
getPathToFile(fileName);
return a.exec();
}
void getPathToFile(QString fileName)
{
QString command = "where /r C:\\Qt\\Qt_Apps " + fileName + ".mpg > C:\\Qt\\Qt_Apps\\resultFind.txt";
QProcess finder;
finder.startDetached(command);
}