• Batch file help

    Author
    Topic
    #505661

    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

    Viewing 0 reply threads
    Author
    Replies
    • #1564770

      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

      Plethora means a lot to me.

    Viewing 0 reply threads
    Reply To: Batch file help

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: