Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm tried to run a command line something like this: start /max C:\Program files\foo\ba.exe -somearguments.

But I have a problem, the cmd returns an error message something like The system cannot found the C:\Program file and if I put the C:\Program files\foo\ba.exe around quotes, it simply run a new window cmd in MAX mode and don't run the program.

How to fix this?

share|improve this question
    
why the donwvote? –  Jack Jun 5 '12 at 16:32

3 Answers 3

up vote 5 down vote accepted

All filenames and paths which contain spaces must be quoted.

Next, regarding your question, how about stating the path like:

start /max /d"C:\Program files\foo\" ba.exe -somearguments
share|improve this answer
    
Thanks very much! :) –  Jack Jun 6 '12 at 2:53

The error happened because the system interpreted your command as the file C:\Program and file as an argument of your command. Obviously it doesn't find the file Program and returned this error.

To fix it, just include "" on the path between the words with the space character or on entire path:

start /max C:\"Program files"\foo\ba.exe -somearguments

or

start /max "C:\Program files\foo\ba.exe" -somearguments
share|improve this answer
    
There needs to be a "" before program path in the second example; see superuser.com/a/239572/1686 on why. –  grawity Jun 5 '12 at 17:13
    
You say I must include it? Ive just tested here now and it worked without "" before... –  Diogo Jun 5 '12 at 17:16
    
It might have changed, then, but cmd.exe on Windows XP would require it. –  grawity Jun 5 '12 at 17:43
    
I've just tried it, and Windows 7 definitely doesn't accept the second example, although the first one works. –  Harry Johnston Jun 6 '12 at 2:16
    
It autocompleted automatically here if start to digit c:Prorg and press TAB. –  Diogo Jun 6 '12 at 2:33

Although wrapping the path in quotes is the easiest and clearest to read, you can also use the old DOS short names (since DOS followed 8.3 naming, file names longer than 8 characters were truncated with ~1) for files. These names do not have spaces. You can see the short names for files with the DIR /X command.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.