我想在控制台中打印变量。但是,我可以看%variable_name%...
这是一个可以解释我的情况的示例代码。
Set a=%b% and i respect you, answer!
Set b=lolol i'm happy
Echo %a%
我想要的是::
lolol i'm happy and i respect you, answer!
结果::
%a% and i respect you, answer!
我怎么解决这个问题?? (我更新了我的问题,对不起...)
首先,您需要变量a
内容中的百分号。加倍他们告诉解析器你想要他们的文字而不是b
的(当前)内容。
然后你需要另一层扩展来评估%a%
(变量)到%b%
(带百分号的文字)然后评估%b%
到b
的内容:
Set a=%%b%% and i respect you, answer!
Set b=lolol i'm happy
call Echo %a%