-1

What is the difference between

ECHO %foo%

and simply

%foo%

In my case the first prints x and the second prints y, where the "correct" value, the one I want to be returned through Environment.GetEnvironmentVariable("foo") is the ECHOed one, x.

I can't figure out how to fix y to be x. When I run

SET

I see

foo=x

which is what I expect. Where is y coming from?

See Sharp
  • 379
  • 1
  • 4
  • 11

1 Answers1

4

ECHO %foo% calls the ECHO command which outputs the value of the foo environment variable.

%foo% calls the command that's named by the foo environment variable found in the current directory or on your path.

You're probably seeing y since the command x outputs that.

Jeff Mercado
  • 129,526
  • 32
  • 251
  • 272