white spaces in command line

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi
I m in trouble with a white space included in the path of an .exe file.
Precisely located in Program Files/...
How to deal with the launching of a command that calls this .exe ?

CreateProcess(NULL, ligne_de_com, NULL, NULL, FALSE,
CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &StartInfo, &Process)

According to the fact that the parser will stop after Program !
Any idea of the usual trick ?
For instance how Windows deals with the launching of the "execute" command
when it includes something in Program Files ?

Thanks for pieces of advice.

Regards

Xavier
 
Hi
I m in trouble with a white space included in the path of an .exe file.
Precisely located in Program Files/...
How to deal with the launching of a command that calls this .exe ?

CreateProcess(NULL, ligne_de_com, NULL, NULL, FALSE,
CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &StartInfo, &Process)

According to the fact that the parser will stop after Program !
Any idea of the usual trick ?
For instance how Windows deals with the launching of the "execute" command
when it includes something in Program Files ?

Thanks for pieces of advice.

Regards

Xavier

Have you tried to quote the path string just like: "c:\program files\...".
You have to put the quote signs the string!

Good Look! Sebastian Dau
 
thank you for answering but what you mean by "signs the quote" ?
since that you declare
CString ST="C:\Program Files\..."
or
char T[100];
strcpy(T,"C:\Program Files\...")
the result will still be that a white space WS will remain between Program
and Files, WS missunderstood by the command line parser unable to achieve the
task.
Xavier
 
Tamas Demjen said:
"\"C:\\Program Files\\...\""

Thanks it seem to match but why ?
Every ones knows that one should "unspecialize" the \ doubling it, obviously
for not letting the compilator parser considere \Program like \P(followed by
rog..) but why could it fix the trouble induced by the presence of WhiteSpace
? I'd like to know.
X
 
thank you for answering but what you mean by "signs the quote" ?
since that you declare
CString ST="C:\Program Files\..."
or
char T[100];
strcpy(T,"C:\Program Files\...")
the result will still be that a white space WS will remain between Program
and Files, WS missunderstood by the command line parser unable to achieve the
task.
Xavier


Sebastian Dau said:
Have you tried to quote the path string just like: "c:\program files\...".
You have to put the quote signs the string!

Good Look! Sebastian Dau

As Tamas wrotes...

"\"text\"" means putting quote signs into a string variable...

Sebastian Dau
 
Thanks it seem to match but why ?

Because the operating system and the CreateProcess function treat
everything delimited by double quotes as a single path. This is one way
to get around the space in filename problem. The other one is using the
GetShortPathName API function, which converts long file names to short
ones (with no spaces).

Tom
 
Back
Top