假设你获取到的信息没有错误,我稍微改了下你的语法错误
仅限语法,至于功能,自己完善- @echo on
- ipconfig /all >1.txt
- setlocal enabledelayedexpansion
- for /f "tokens=2,3 skip=9 delims=器:" %%p in (1.txt) do (
- set /a str+=1
- if !str!==1 call :a "%%p"
- )
-
- eixt
- :a
-
- netsh interface ip set address name="%~1" source=static addr=192.168.1.187 mask=255.255.255.0 gateway=192.168.1.1
- pause
复制代码
|