Results 1 to 2 of 2

Thread: Batch file help

  1. #1
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    9,121
    Thanks
    64
    Thanked 1,125 Times in 1,048 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,564
    Thanks
    36
    Thanked 212 Times in 189 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

    Mission: identify what we do best and find more ways of doing less of it better

Posting Permissions

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