I\'m trying to define and use a variable in a batch file. It looks like it should be simple:
@echo off
set locatio
The spaces are significant. You created a variable named 'location '
with a value of
' "bob"'. Note - enclosing single quotes were added to show location of space.
If you want quotes in your value, then your code should look like
set location="bob"
If you don't want quotes, then your code should look like
set location=bob
Or better yet
set "location=bob"
The last syntax prevents inadvertent trailing spaces from getting in the value, and also protects against special characters like & | etc.