@echo off
set /a hlo=Hello
:start
echo %hlo%
pause
set /a hlo=%hlo% + World
goto start
pause
我想使“ hlo”成为“ HelloWorld”。
答案 0 :(得分:1)
只需删除/a
set "hlo=Hello"
set "hlo=%hlo% World"
因为set /a
用于算术,而不用于字符串运算
set /?
...
Two new switches have been added to the SET command:
SET /A expression
SET /P variable=[promptString]
The /A switch specifies that the string to the right of the equal sign
is a numerical expression that is evaluated. The expression evaluator
is pretty simple and supports the following operations, in decreasing
order of precedence:
...