PC Review


Reply
Thread Tools Rate Thread

Why this batch file doesn't work?

 
 
Maxwell2006
Guest
Posts: n/a
 
      25th Apr 2006
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


 
Reply With Quote
 
 
 
 
David Candy
Guest
Posts: n/a
 
      25th Apr 2006
set V=VARIABLE
ECHO %V%


--
--------------------------------------------------------------------------------------------------
How to lose a war in Iraq
http://webdiary.com.au/cms/?q=node/1335#comment-48641
=================================================
"Maxwell2006" <(E-Mail Removed)> wrote in message news:(E-Mail Removed)...
> 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
>
>

 
Reply With Quote
 
 
 
 
Jon
Guest
Posts: n/a
 
      25th Apr 2006

"Maxwell2006" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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

 
Reply With Quote
 
Bob I
Guest
Posts: n/a
 
      25th Apr 2006
lose the spaces, as in

SET V=VARIABLE

Maxwell2006 wrote:

> 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
>
>


 
Reply With Quote
 
Pegasus \(MVP\)
Guest
Posts: n/a
 
      25th Apr 2006

"Maxwell2006" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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.


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
why why why why why Mr. SweatyFinger Microsoft ASP .NET 4 21st Dec 2006 02:15 PM
findcontrol("PlaceHolderPrice") why why why why why why why why why why why Mr. SweatyFinger Microsoft ASP .NET 2 2nd Dec 2006 04:46 PM
[OT batch file] Turn off/on various software in batch reader@newsguy.com Windows XP General 2 9th Sep 2006 04:26 AM
Calling Batch within a Batch file Bobby Stiklus Microsoft Windows 2000 Developer 1 27th Apr 2004 06:40 PM
Calling Batch within a Batch File ChuckR Microsoft Windows 2000 Developer 0 22nd Apr 2004 02:33 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:33 PM.