How to call a program that contains space in filename?
Become or hire the top 3% of the developers on Toptal https://topt.al/25cXVn
--------------------------------------------------
Music by Eric Matyas
https://www.soundimage.org
Track title: Romantic Lands Beckon
--
Chapters
00:00 Question
00:46 Accepted answer (Score 19)
01:07 Answer 2 (Score 18)
01:42 Answer 3 (Score 6)
02:11 Answer 4 (Score 3)
02:24 Thank you
--
Full question
https://superuser.com/questions/432980/h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#windows #commandline
#avk47
ACCEPTED ANSWER
Score 19
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
ANSWER 2
Score 18
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
ANSWER 3
Score 6
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.
ANSWER 4
Score 3
In Win10 you can try this:
start /max C:\Program%20files\foo\ba.exe -somearguments