为什么在cmd中使用'set var = text'命令后没有'echo %var%'的字符串输出? [英] Why is no string output with 'echo %var%' after using 'set var = text' command in cmd?
本文介绍了为什么在cmd中使用'set var = text'命令后没有'echo %var%'的字符串输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用 set
命令在 cmd 中设置了一个变量,并试图 echo
它.
I set a variable in cmd with the set
command, and tried to echo
it.
这是一个例子:
C:UsersLogan>set var = text
C:UsersLogan>set var
var = text
C:UsersLogan>echo %var%
%var%
C:UsersLogan>
有没有办法强制 cmd echo
变量而不是原始文本?
Is there a way to force the cmd to echo
the variable and not the raw text?
推荐答案
你需要让你的文本离等号更近:
You need to bring closer your text from the equal symbol :
set var=text
echo %var%
text
这篇关于为什么在cmd中使用'set var = text'命令后没有'echo %var%'的字符串输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文