Reputation: 15958
In the batch file below I expect "C:\test Ground\" as the output
set loc= C:\test Ground\
set withQuotes="%loc%"
But what I get is " C:\test Ground\" (notice the extra leading space after the quotes begin)
How do I fix this?
Upvotes: 2
Views: 103
Reputation: 8561
Just get rid of the space between the =
and the C
on the first line:
set loc=C:\test Ground\
If that's not an option, you can extract the remainder of the string without the space using batch's substring functionality:
set withQuotes="%loc~1%"
Upvotes: 3