The Wiert Corner – irregular stream of stuff

Jeroen W. Pluimers on .NET, C#, Delphi, databases, and personal interests

  • My badges

  • Twitter Updates

  • My Flickr Stream

  • Pages

  • All categories

  • Enter your email address to subscribe to this blog and receive notifications of new posts by email.

    Join 1,860 other subscribers

How do I get the IP address into a batch-file variable? – Stack Overflow

Posted by jpluimers on 2018/11/13

Since ping has a more predictible  output over Windows versions than ipconfig, I use this in a batch file:

for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %ComputerName% ^| findstr [') do set NetworkIP=%%a
echo Network IP: %NetworkIP%

Source: [WayBackHow do I get the IP address into a batch-file variable? – Stack Overflow

Thanks [WayBackbruce965.

–jeroen

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.