The problem is likely a combination.
The syntax set "var=string"
sets tha value of var
to string
, whereas set var="string"
sets the value of var
to "string"
.
The first form is used to ensure that any trailing spaces on the line are not included the value assigned. The second includes quotes in the value assigned.
hence your set /a q...
command would be resolved to
set /a q="5 "+" 1"
The solution is to use
set "y=+"
and
set /a q=%z% %y% 1