读书人

C++怎么修改本机IP

发布时间: 2013-01-08 14:02:14 作者: rapoo

C++如何修改本机IP
就是实现修改本机IP、修改子网掩码、默认网关、DNS的功能,并测试本机网络连接情况。C++或者C使用什么函数或者库?
大神们提供点思路吧
谢谢了
[解决办法]
一个批处理.bat仅供参考

if "%1"=="l" goto l
if "%1"=="w" goto w
echo 网络地址切换批处理
echo setip l ——切换到本地连接
echo setip w ——切换到无线网络连接
goto e

:l
echo 从无线网络的静态ip切换到有线网络的静态ip:
netsh interface ip set address 无线网络连接 dhcp
netsh interface ip set dns 无线网络连接 dhcp
netsh interface ip set address 本地连接 static 192.168.1.111 255.255.252.0 192.168.2.1 1
netsh interface ip set dns 本地连接 static 202.106.196.115
goto e

:w
echo 从有线网络的静态ip切换到无限网络的静态ip:
netsh interface ip set address 本地连接 dhcp
netsh interface ip set dns 本地连接 dhcp
netsh interface ip set address 无线网络连接 static 192.168.1.5 255.255.255.0 192.168.1.1 1
netsh interface ip set dns 无线网络连接 static 211.97.168.129
goto e

:e

读书人网 >C++

热点推荐