
CODE: [Copy to clipboard]如果只有一个,则变量名为ip_1,否则继续为ip_2,ip_3等,范围由变量n决定@echo off&setlocal enabledelayedexpansion
for /f "tokens=2 delims=:" %%a in ('ipconfig/all^|find /i "ip address"') do (
set a=%%a
if "!a:~0,13!"==" 192.168.1.10" (
set/a n+=1
set ip_!n!=!a:~1,-1!
))
CODE: [Copy to clipboard][code]@echo off&setlocal enabledelayedexpansion
for /f "tokens=2 delims=:" %%a in ('ipconfig/all^|find /i "ip address"') do (
set a=%%a
if "!a:~0,13!"==" 192.168.1.10" set ip=!a:~1,-1!
)
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |