Why this batch file doesn't work?

Discussion in 'Windows XP General' started by Maxwell2006, Apr 25, 2006.

  1. Maxwell2006

    Maxwell2006 Guest

    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, Apr 25, 2006
    #1
    1. Advertisements

  2. Maxwell2006

    David Candy Guest

    set V=VARIABLE
    ECHO %V%


    --
    --------------------------------------------------------------------------------------------------
    How to lose a war in Iraq
    http://webdiary.com.au/cms/?q=node/1335#comment-48641
    =================================================
    "Maxwell2006" <> wrote in message news:...
    > 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
    >
    >
     
    David Candy, Apr 25, 2006
    #2
    1. Advertisements

  3. Maxwell2006

    Jon Guest

    "Maxwell2006" <> wrote in message
    news:...
    > 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
     
    Jon, Apr 25, 2006
    #3
  4. Maxwell2006

    Bob I Guest

    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
    >
    >
     
    Bob I, Apr 25, 2006
    #4
  5. "Maxwell2006" <> wrote in message
    news:...
    > 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.
     
    Pegasus \(MVP\), Apr 25, 2006
    #5
    1. Advertisements

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jonefer
    Replies:
    3
    Views:
    466
    jonefer
    Nov 20, 2003
  2. Larry(LJL269)

    REM in batch file doesnt print text

    Larry(LJL269), Jun 21, 2006, in forum: Windows XP General
    Replies:
    6
    Views:
    213
    Larry(LJL269)
    Jun 23, 2006
  3. Replies:
    2
    Views:
    317
    Pegasus \(MVP\)
    Sep 9, 2006
  4. Stephen Rainey

    Save batch window msgs to a file from the batch prog

    Stephen Rainey, Jan 8, 2007, in forum: Windows XP General
    Replies:
    3
    Views:
    568
    Paul Johnson
    Jan 10, 2007
  5. Danger
    Replies:
    7
    Views:
    926
    Pegasus \(MVP\)
    Feb 5, 2008
Loading...

Share This Page