Batch file 如何在批处理中组合变量和文本字符串? @echo关闭 set/a hlo=Hello :开始 回显%hlo% 暂停 设置/a hlo=%hlo%+世界 开始 暂停

Batch file 如何在批处理中组合变量和文本字符串? @echo关闭 set/a hlo=Hello :开始 回显%hlo% 暂停 设置/a hlo=%hlo%+世界 开始 暂停,batch-file,environment-variables,Batch File,Environment Variables,我想把hlo变成“HelloWorld”。只需删除/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 stri

我想把
hlo
变成“HelloWorld”。

只需删除
/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:
...
谢谢!(这是一个很漂亮的问题,但很难记住所有的问题);)