Important: Please read the Qt Code of Conduct -

Executing BAT file using Qprocess

  • when my bat files are located in C folder program working fine but when i moved bat file from windows C to E Qt fails to call bat file.
    This is my program
    QProcess process;
    process.setProgram( "cmd.exe" );
    process.setArguments( { "/C", R"(E:\Run.bat)" } );
    process.setWorkingDirectory( R"(E:\ )" );
    process.setStandardOutputFile( QProcess::nullDevice() );
    process.setStandardErrorFile( QProcess::nullDevice() );
    Please help to resolve..

  • Lifetime Qt Champion

    You should check if it gives error

    connect(&process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) 
        qDebug() << "error enum val = " << error; 

  • Sorry, issue has been resolved it just beacause path of file within bat file was wrong..Thank you @mrjj

Log in to reply