In first.bat, I use
var5=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\
CALL scripts\vc64.bat %var5%
And in scripts\vc64.bat, I use
SET var6=%1vcvarsx86_amd64.bat
CALL %var6%
But I get : 'C:\Programvcvarsx86_amd64.bat' is not internal or external command.....
error.
If the path assigned to var5 has no space, then it is fine.
I tried several combination of quotations and %1vcvarsx86_amd64.bat
, but no change.
How do I make it works with path with spaces?
To be more precise, suppose it is C:\a b c\
In first.bat:
SET var6=C:\a b c\ =====> '"C:\avcvarsx86_amd64.bat"' is not.....`
SET var6="C:\a b c\" ====> There should not be a b
SET var6=C:\a\ b\ c\ ====> Can't find the specified path
SET var6=C:\a b c\ + Using "%var6" ====> There should not be a b
Update: Here is an example. Change a b to ab works.
call.bat in C:\
@ECHO OFF
SET var5=C:\a b\
CALL C:\1.bat "%var5%"
pause
1.bat in C:\
@ECHO OFF
SET var6=%~1Test.bat
CALL %var6%
RMDIR /S C:\NoWorry
Test.bat in C:\a b Test.bat in C:\ab
@ECHO OFF
RMDIR /S C:\ThereIsNoSuchFolder
Answer
To pass parameters with spaces you need to quote the parameter, then you can remove the quotes using %~1
.
So the full script would look like
SET var5=C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\x86_amd64\
CALL scripts\vc64.bat "%var5%"
SET var6=%~1vcvarsx86_amd64.bat
CALL %var6%
No comments:
Post a Comment