Results 1 to 2 of 2

Thread: Batch file help

  1. #1
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,180
    Thanks
    47
    Thanked 983 Times in 913 Posts

    Batch file help

    Why does this work? It correctly returns the IP address with dots, but the dot is a delimiter and therefore should be 3 items, no?
    for /f "tokens=1,2* delims=.: " %x in ('ipconfig') do if "%x %y"=="IPv4 Address" echo %z

    cheers, Paul

  2. #2
    Super Moderator BATcher's Avatar
    Join Date
    Feb 2008
    Location
    A cultural area in SW England
    Posts
    3,414
    Thanks
    33
    Thanked 195 Times in 175 Posts
    Very interesting!

    If I replace the 1,2* by 1-3 I get the expected result 192 rather than 192.168.1.234

    So the specification of * is the factor, but I have no idea why it gives the Wrong Answer.
    I shall inquire...
    BATcher

    Time prevents everything happening all at once...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •