本帖最后由 ygqiang 于 2011-10-17 01:08 编辑
4楼修改后的代码,就正常了。- for /f "tokens=2 delims=:" %%i in ('ipconfig ^| findstr /c:"IP Address"') do set i=%%i
- for /f "tokens=1,2,3,4 delims=." %%i in ("%i: =%") do (set Gateway=%%i.%%j.%%k.1
- set date=%%i.%%j.%%k)
-
- if "%date%" == "10.10.9" goto set1
- if "%date%" == "10.10.93" goto set1
- if "%date%" == "10.10.94" goto set1
- if "%date%" == "10.10.127" goto set1
-
- echo 未做更改
- pause
- goto :continue
-
- :set1
- netsh i i set address name="本地连接" gateway=%Gateway% gwmetric=1
- echo 你的网关已经设定为: %Gateway%
-
- pause
-
-
- :continue
复制代码
|