Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9154711
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T12:28:20+00:00 2026-06-17T12:28:20+00:00

I have very strange problem with QProcess and it’s strange behaviour. What i wanna

  • 0

I have very strange problem with QProcess and it’s strange behaviour.

What i wanna get at the end is something like this (this is cmd.exe in windows 7)

C:\path_to_somewhere>cmd /c "C:\Program Files\path_to_dir\executable"

(cmd is for compatibility with show of QProcess)

So to do something like that i create this:

QProcess proc;
QString command;
QStringList attributes;

command = "c:\\windows\\system32\\cmd.exe";
QStringList << QString("/c \"C:\\Program Files\\path_to-dir\\executable"");
proc.start(command, attributes);

What i get on error output is:

Name '\"c:\Program Files\Quantum GIS Wroclaw\bin\gdalwarp.exe\"' is not recognized as
internat or external command, executable or batch file.

(it’s translated by me from polish so it may be a little diffrent in english).

Seems like the \ character is not escaped in the string, leaving the \” as to characters in command. What am I doing wrong?

I’ve tried the

proces.start(QString) 

function with triple \”\”\” and it doesnt work either. I suppose the solution of this problem has to be sooo easy that I dont event think about it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T12:28:21+00:00Added an answer on June 17, 2026 at 12:28 pm

    As you already noted, Qt wraps arguments containing spaces with quotes, which means that the actual command issued by QProcess will look something like that (not sure about the inner quotes):

    c:\windows\system32\cmd.exe "/c \"C:\Program Files\path_to_dir\executable\""
    

    which is not what you want: the entire string is passed to cmd including /c. Since /c and the path are two arguments, you should pass them separately to QProcess, without worrying about spaces as they will be handled automatically:

    QString command = "cmd.exe";
    QStringList arguments = 
        QStringList() << "/c" << "C:\\Program Files\\path_to_dir\\executable";
    // note there are two arguments now, and the path is not enclosed in quotes
    proc.start(command, arguments);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have very strange problem with IsNumeric function in classic asp fail. Something like
I have this very strange problem while compiling the project. MOC seems to be
I have a very strange problem with IE8; I have reduced this as much
I have this very strange problem on a big flex app where it would
I have a very strange problem with wordpress. I have this kind of pages:
I have a very strange problem that I cannot solve. There is something preventing
I have a very strange problem with facebook OG. https://fit.upjet.com/en/pages/news/270/ - this is a
I have very strange problem while I am submitting a practice problem on codechef.
I have a very strange problem when I'm testing my application on device. I
I have a very strange problem. I have a working WCF service. [ServiceContract] public

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.