Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Executing BAT file using Qprocess

Executing BAT file using Qprocess

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 483 Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shree_121
    wrote on last edited by shree_121
    #1

    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() );
    process.startDetached();
    Please help to resolve..

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by mrjj
      #2

      Hi
      You should check if it gives error

      connect(&process, &QProcess::errorOccurred, [=](QProcess::ProcessError error) 
      { 
          qDebug() << "error enum val = " << error; 
      });
      
      1 Reply Last reply
      3
      • S Offline
        S Offline
        shree_121
        wrote on last edited by
        #3

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

        1 Reply Last reply
        2

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved