Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!
中国DOS联盟论坛 » DOS疑难解答 & 问题讨论 (解答室) » I want to use IPCONFIG /ALL to list values like the IP and gateway, then assign those two values to AAA and BBB
View 737 Replies 3
Credits 2,013 Posts 718 Joined 2006-02-18 07:07 20-year member UID 50550
Status Offline
for /f "delims=: tokens=2" %i in ('"ipconfig | find /i "ip address""') do set ip=%i
for /f "delims=: tokens=2" %i in ('"ipconfig | find /i "default gateway""') do set gateway=%i
If you use it in a batch file, you need to change %i to %%i