|
如果你经常需要在不同的网络环境中使用装有Win2K的笔记本,每次换地方,都要不厌其烦的手工修改网络参数。Netsh命令可以帮助你保存当前网络配置到文件中,在需要的时候可以快速的完全恢复过来。
保存当前网络配置,在命令行输入:
C:\> netsh -c interface dump > networking.txt
你可以为每一个网络环境生成单独的配置文件。
恢复网络配置:
C:\> netsh -f networking.txt
这样,借助Netsh命令,你就可以快速切换不同的网络配置参数,更加方便的移动办公!
注意win 2000以下不支持netsh 如果通过Windows的网络属性修改Ip/网关,真是太麻烦了。 最近一个项目经常要切换ip,所以我写了两个脚本: c:\116.bat netsh interface ip set address "本地连接" static 10.45.128.116 255.255.255.0 10.45.128.254 1
c:\172.bat netsh interface ip set address "本地连接" static 172.17.9.222 255.255.255.0 172.17.9.51 1
这样就可以设置IP/Mask/GateWay了,netsh命令真方便!
如何加多个dns?
我查了一下,dns可以配置多个,如下: netsh interface ip add dns name = "本地连接" addr = 202.105.12.226 netsh interface ip add dns name = "本地连接" addr = 61.144.56.100 netsh interface ip add dns name = "本地连接" addr = 202.96.128.68 netsh interface ip add dns name = "本地连接" addr = 202.96.128.86
清空DNS: netsh interface ip set dns name = "本地连接" static addr = none
使用dhcp自动分配ip: netsh interface ip set address name="本地连接" source=dhcp
|