最近发现附件一个无线网络可以连接上,但是无线路器没有开启 DHCP 服务,获取不到IP地址,测试了192.168.x.x 等,都不对。后来想到下边的方法:
首先,必须可以连接到无线网络
建立以下5个批处理(BAT)文件
@echo ********* cr.bat ******** @echo 修改IP地址并遍历网关地址 FOR /L %i IN (100,1,254) do CALL "cr2.bat" %%i
cr2.bat
rem ********* cr2.bat ********* FOR /L %%j IN (1,1,254) do CALL "cr3.bat" %1 %%j
cr3.bat
rem ********* cr3.bat ********* FOR /L %%k IN (1,1,254) do CALL "setip.bat" %1 %2 %%k
setip.bat
@echo ********* setip.bat ********* @echo ******** Set IP Address To %1.%2.%3 netsh int i set address name="你的网络连接名字,如本地网络" source=static addr=%1.%2.%3.9 mask=255.255.255.0 gwmetric=1 >> netsh.out ping %1.%2.%3.1 rem 如果需要遍历某一网段的IP地址,去掉下边的REM rem FOR /L %%m IN (1,1,254) do call ping1.bat %1 %2 %3 %%m
如果需要Ping的话再编写ping1.bat
@echo *** Ping %1.%2.%3.%4 if /I %4 NEQ 9 ping "%1.%2.%3.%4"