Results 1 to 2 of 2

Thread: Batch file help

  1. #1
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,517
    Thanks
    54
    Thanked 1,038 Times in 966 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,472
    Thanks
    34
    Thanked 197 Times in 177 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

    "The trouble with quotes on the internet is that you can never know if they are genuine."
    Abraham Lincoln
    

Posting Permissions

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