Jump to content

cmd quotes problem


rumca.js
 Share

Recommended Posts

Hello

I'm trying to invoke console program with parameter containing spaces (as one parameter). To make long story short I will say that I need to call program by CMD and with full path to application

so it lookes like this:

cmd /c "C:\Program Files\argumentator.exe" argument with space (4 arguments are passed into the program, but it's not what I intended)

cmd /c "C:\Program Files\argumentator.exe" "argument with space" (does not work)

cmd /c "C:\Program Files\argumentator.exe" \"argument with space\" (does not work either)

Link to comment
Share on other sites

yes. space characters are part of argument.

"does not work" mean that the first quotes are not preserved. I don't know how to translate error message into english though; it's says that

'C:\Program' is not a name of a program.

I read that the quotes are preserved only if there is one set of quotes (so I don't know if it is solvable...)

http://www.microsoft.com/resources/documen...d.mspx?mfr=true

Link to comment
Share on other sites

Hmm, I really don't know how to solve that, although I think it should be possible.

Does it work correctly if there are no space characters in the argument? If so, could you replace the actual space character (0x20) with a non-breaking space character (0xA0) ?

Link to comment
Share on other sites

Hm. If I replace every space character in query with non breaking space (160 dec, in my program -96 integer value, A0 hex, looks like á in console) problem still exists, quotes are not preserved, and cmd says 'C:\Program' is not a name of a program.

Argument is passed correctly only if there's only one set of quotes, but it's cut into pieces when space occurs. So probably it was a good thought to look for something that would be substitue of quotes, or would be an escape characters for them (as well thought about non-breaking space about which I didn't know).

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy