搜索
查看: 4878|回复: 0

DOS下修改 IP/DNS/网关 信息【适合网吧批量】

[复制链接]
发表于 2008-9-8 12:38:13 | 显示全部楼层 |阅读模式 来自 河南郑州
在 Windows XP 中可以使用 netsh 命令为以下过程编写脚本:将计算机的静态 Internet 协议 (IP) 地址更改为动态主机配置协议 (DHCP) 地址或相反。netsh 命令无需重新启动计算机即可完成此任务。对于从一个环境移到另一个环境的便携式计算机,当它在一个位置中必须使用静态分配的 IP 地址,而在另一个位置必须使用 DHCP 分配的 IP 地址时,此功能尤其有用。
本文所说的方法适应于Windows 2000,Windows XP和Windows Server 2003。

要将指定适配器的静态地址切换为 DHCP 地址,请键入以下命令:
netsh interface ip set address "本地连接" dhcp
注意:键入此命令会将名为"本地连接"的接口更改为 DHCP。

要显示计算机中的所有适配器及其当前 IP 地址,以确定正确的适配器名称,请键入以下命令:
Netsh interface ip show config
要更改为静态地址,请键入以下命令:
netsh interface ip set address "本地连接" static  IP  掩码  网关  跃点数
如:
netsh interface ip set address "本地连接" static 192.168.0.10 255.255.255.0 192.168.0.1 1

更改DNS为192.168.0.1:
netsh interface ip set DNS  "本地连接" static 192.168.0.1
删除网关:
netsh interface ip delete address "本地连接" gateway=all
删除DNS:
netsh interface ip delete dns "本地连接" all

如果执行配置时提示"指定了无效的接口",则请您开启系统的"Remote Registry Service"服务。

控制面板-->管理工具-->服务-->开启Remote Registry Service

用Dos命令修改DNS
在 Windows 2000 中可以使用 netsh 命令为以下过程编写脚本:将计算机的静态 Internet 协议 (IP) 地址更改为动态主机配置协议 (DHCP) 地址或相反。netsh 命令无需重新启动计算机即可完成此任务。对于从一个环境移到另一个环境的便携式计算机,当它在一个位置中必须使用静态分配的 IP 地址,而在另一个位置必须使用 DHCP 分配的 IP 地址时,此功能尤其有用。
本文所说的方法适应于Windows 2000,Windows XP和Windows Server 2003。

要将指定适配器的静态地址切换为 DHCP 地址,请键入以下命令:
netsh interface ip set address "本地连接" dhcp
注意:键入此命令会将名为"本地连接"的接口更改为 DHCP。

要显示计算机中的所有适配器及其当前 IP 地址,以确定正确的适配器名称,请键入以下命令:
Netsh interface ip show config
要更改为静态地址,请键入以下命令:
netsh interface ip set address "本地连接" static  IP  掩码  网关  跃点数
如:
netsh interface ip set address "本地连接" static 192.168.0.10 255.255.255.0 192.168.0.1 1

更改DNS为192.168.0.1:
netsh interface ip set DNS  "本地连接" static 192.168.0.1
设置主DNS为202.102.224.68
netsh int ip set dns "本地连接" static 202.102.224.68 primary
添加202.102.224.86备用DNS:
netsh int ip add dns name="本地连接" 202.102.224.86
删除网关:
netsh interface ip delete address "本地连接" gateway=all
删除DNS:
netsh interface ip delete dns "本地连接" all

如果执行配置时提示"指定了无效的接口",则请您开启系统的"Remote Registry Service"服务。

控制面板-->管理工具-->服务-->开启Remote Registry Service
游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表