Why this batch file doesn't work?

  • Thread starter Thread starter Maxwell2006
  • Start date Start date
M

Maxwell2006

Hi,

I have the following two statements in my batch file:

set V = VARIABLE
ECHO %V%

When I run the batch file, it doesn't output the variable V. Why?

Thank you,
Max
 
Maxwell2006 said:
Hi,

I have the following two statements in my batch file:

set V = VARIABLE
ECHO %V%

When I run the batch file, it doesn't output the variable V. Why?

Thank you,
Max

Try it without the spaces ie

set V=VARIABLE
ECHO %V%

Jon
 
Maxwell2006 said:
Hi,

I have the following two statements in my batch file:

set V = VARIABLE
ECHO %V%

When I run the batch file, it doesn't output the variable V. Why?

Thank you,
Max

Instead of dropping the spaces as suggested by other
respondents, you could also do this to shed a little more
light on your problem:

echo xxxx%V %xxxxx

Note the space after the "V". This shows you clearly what
happens to spaces.
 
Back
Top