Click here to Skip to main content
15,885,951 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more: (untagged)
hi ,


i am facing problem while compiling c and c++ files from command prompt when there is gap between the directory names....

example:-C:\Program Files>

in above example there is gap between "program " and " Files"... similarly directories like "Documents and Settings" .... how can we solve this problem when files to be compiled in these kind of directories...
Posted

Just as you did in your question! Put them in double quotes. The command processor (and many other programs) knows how to strip quotes from around file names (and other things) with embedded spaces.

For example:
progname "this is all argv[1]" argv2
progname argv1 argv2 argv3


Cheers,
Peter
 
Share this answer
 
Comments
pasupulety 16-May-12 1:15am    
when i use c:\> cd "Program Files" after pressing enter it is becoming c:\Program Files> once again facing the problem while compiling from this path... can u please explain briefly....
Peter_in_2780 16-May-12 1:22am    
Just keep on doing it.
c:\Program Files>compile "c:\path with spaces\file" option1 ... or whatever you need
Andy411 16-May-12 1:48am    
My 5 for the correct answer
Sergey Alexandrovich Kryukov 1-Jun-12 12:10pm    
Right, a 5.
--SA
First you check from command prompt what is the directory name. For example
c:>program files are named as c:>progra~1.
C++ Basics
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 1-Jun-12 12:11pm    
Aha, supporting deprecated short names? Have a vote of 1!
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900