Results 1 to 2 of 2

Thread: Batch file help

  1. #1
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,950
    Thanks
    61
    Thanked 1,104 Times in 1,027 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,532
    Thanks
    36
    Thanked 207 Times in 186 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

    milliHelen
    (unit): that quantity of female facial beauty sufficient to launch a single ship

Posting Permissions

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