As we know that windows, we can create folders with a name contains spaces(Hello World,New Folder,My Programs). In the commandline if we use start c:\Hello World\mygame.exe , it gives error called Hello is not found. it split the word from the space, to avoid this we can use thid start c:\"Hello World"\mygame.exe. my problem is this set x=%cd% (Here cd is "c:\Hello World开发者_C百科" ) and we execute mygame.exe using this command "start %cd%\mygame.exe" which gives error of Hello is not found. Anyone knows solution for this?
Instead of putting quotes around just part of the path, put quotes around the entire path. If you do that, you should be fine.
start "%cd%\mygame.exe"
In the set command put quotes around the whole assignment:
set "x=%cd%"
In the start command, use quotes as well:
start "%x%\mygame.exe"
for example, if you have a folder name FOO FOO with a space and you want to access from cmd yo just do:
cd "FOO FOO"
That's all
精彩评论