Why this batch file doesn't work?

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
 
J

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

Try it without the spaces ie

set V=VARIABLE
ECHO %V%

Jon
 
P

Pegasus \(MVP\)

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top