QProcess :: startDetached will take the first parameter as the command to execute, and the following parameters, separated by a space, will be interpreted as separate arguments to the command.
Therefore, in this case: -
QProcess::startDetached("cmd /c net stop \"MyService\"");
The function sees cmd as a command and passes / c, net, stop and "MyService" as arguments to cmd. However, apart from / c, the rest are analyzed separately and are not valid arguments.
, "net stop" "MyService", , : -
QProcess::startDetached("cmd /c \"net stop \"MyService\"\"");
, , : -
QProcess::startDetached("cmd", QStringList() << "/c" << "net stop \"MyService\"");