Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is no string output with 'echo %var%' after using 'set var = text' command in cmd? [duplicate]

I set a variable in cmd with the set command, and tried to echo it.

Here is an example:

C:\Users\Logan>set var = text

C:\Users\Logan>set var
var = text

C:\Users\Logan>echo %var%
%var%

C:\Users\Logan>

Is there a way to force the cmd to echo the variable and not the raw text?

like image 285
Logern Avatar asked Oct 15 '14 15:10

Logern


1 Answers

You need to bring closer your text from the equal symbol :

set var=text
echo %var%
text
like image 70
CrYoSoRe Avatar answered Sep 18 '22 15:09

CrYoSoRe