473,406 Members | 2,633 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

white spaces in command line

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

Nov 17 '05 #1
6 1207

"se******@yahoo.fr" <se*************@discussions.microsoft.com> wrote in
message news:B8**********************************@microsof t.com...
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
Nov 17 '05 #2
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" wrote:

"se******@yahoo.fr" <se*************@discussions.microsoft.com> wrote in
message news:B8**********************************@microsof t.com...
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

Nov 17 '05 #3
se******@yahoo.fr wrote:
CString ST="C:\Program Files\..."


"\"C:\\Program Files\\...\""

Tom
Nov 17 '05 #4


"Tamas Demjen" wrote:
se******@yahoo.fr wrote:
CString ST="C:\Program Files\..."
"\"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

Tom

Nov 17 '05 #5

"se******@yahoo.fr" <se*************@discussions.microsoft.com> wrote in
message news:C3**********************************@microsof t.com...
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" wrote:

"se******@yahoo.fr" <se*************@discussions.microsoft.com> wrote in
message news:B8**********************************@microsof t.com...
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


As Tamas wrotes...

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

Sebastian Dau
Nov 17 '05 #6
se******@yahoo.fr wrote:
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
Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: qwweeeit | last post by:
Hi all, I need to limit as much as possible the lenght of a source line, stripping white spaces (except indentation). For example: .. . max_move and AC_RowStack.acceptsCards ( self,...
2
by: \Dandy\ Randy | last post by:
Hello everyone. I have been following misc posts, as well as reading several FAQ's on this issue, unfortunatley I cannot locate a solution. I am hoping that someone will be able to provide me with...
12
by: JA | last post by:
Is there a way to remove all the white space in the fields? I have been using Find-and-replace - looking for 2 or 3 or 4 or 10 spaces and replacing them with none. I don't want to replace single...
12
by: snow | last post by:
Hi All, I noticed if file path has a white space, for example "C:\my document \test.txt", the function File.Exists(filePath) always return false in release mode. How could I make this function...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.