Using the Command Line and Paths with Spaces

Started by
3 comments, last by visitor 15 years, 1 month ago
In the command line, sometimes I need to execute a command whose path includes spaces, i.e. C:\Program Files\Stuff\doStuff.exe I am aware that you surround a path including spaces with double quotes, but the problem arises when I need to use a command that has parameters: "C:\Program Files\Stuff\doStuff.exe" "C:\Users\Me\Documents\stuff.txt" When I tried doing the above, I got an error message: "The system cannot find the path specified." Anyone know how to fix this?
Advertisement
That should be how you do it.. What if you cd to "C:\Program Files\Stuff" and instead do

doStuff.exe "C:\Users\Me\Documents\stuff.txt"

HomerSp - Thanks for the tip, but I'd prefer to have a more elegant solution than to monkey with the directory the command line starts from.
Well i do know years ago before win 3.1 and even into 3.1 you could do something like say Program~1 in place and that fixed it. I don't know if you can still do this or not. You might find it under google for old dos stuff and hey it may still work but again idk if that will help any at all
Perhaps you have just mistyped something. And another thing, don't put your programs in Program Files or anything containing spaces (doesn't Program Files have more limited permissions?) :)

If you have many programs in a Stuff folder you can create a desktop shortcut to command exe and set it to begin in that folder in the shortcut properties.

This topic is closed to new replies.

Advertisement