在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:\Users\Logan>set var = text
C:\Users\Logan>set var
var = text
C:\Users\Logan>echo %var%
%var%
C:\Users\Logan>
是否有一种方法可以强制将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屋!
查看全文