使用批处理命令设置windows系统的ip地址和dns附图
网络编程
找到对应的网卡名称
使用命令:ipconfig
我们现在需要设置的网卡名称为"本地连接",ip地址为192.168.1.111,子网掩码为255.255.255.0,dns地址为8.8.8.8
将ip和dns设置为自动获取
使用命令:
netsh interface ip set address "本地连接" dhcp
netsh interface ip set dns "本地连接" dhcp
相当于操作:
将ip和dns设置为固定的值
使用命令:
netsh interface ip set address "本地连接" static [ip地址] [子网掩码] [网关] [网关跳远点数:一般填1]
netsh interface ip set dns "本地连接" static [dns地址]
相当于操作:
使用命令:ipconfig
ipconfig/all
Windows IP Configuration
Host Name . . . . . . . . . . . . : D501-4-3
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Unknown
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
Ethernet adapter 本地连接:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Marvell Yukon 88E8057 PCI-E Gigabit
Ethernet Controller
Physical Address. . . . . . . . . : 44-37-E6-1D-5B-F1
Dhcp Enabled. . . . . . . . . . . : No
IP Address. . . . . . . . . . . . : 192.168.1.111
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
DNS Servers . . . . . . . . . . . : 8.8.8.8
我们现在需要设置的网卡名称为"本地连接",ip地址为192.168.1.111,子网掩码为255.255.255.0,dns地址为8.8.8.8
将ip和dns设置为自动获取
使用命令:
netsh interface ip set address "本地连接" dhcp
netsh interface ip set dns "本地连接" dhcp
netsh interface ip set address "本地连接" dhcp
确定。
netsh interface ip set dns "本地连接" dhcp
确定。
相当于操作:

将ip和dns设置为固定的值
使用命令:
netsh interface ip set address "本地连接" static [ip地址] [子网掩码] [网关] [网关跳远点数:一般填1]
netsh interface ip set dns "本地连接" static [dns地址]
netsh interface ip set address "本地连接" static 192.168.1.111 255.255.255.0 192
.168.1.1 1
确定。
netsh interface ip set dns "本地连接" static 8.8.8.8
确定。
相当于操作:

利用DOS命令来对抗U盘病毒保护U盘数据
U盘的便捷性与大容量的存储性,深受着广大用户的欢迎,几乎每个用户都会人手一个,但就是这么广泛的使用,以至于U盘被病毒悄悄盯上,越来越多的
建立隐藏磁盘的bat代码
@ECHOOFFMDE:RECYCLERUDrives.{645FF040-5081-101B-9F08-00AA002F954E}NULIFEXISTX:NULGOTODELETESUBSTX:E:RECYCLERUDrives.{645FF040-5081-101B-9F08-00AA002F954E}STARTX:GOTOEND:DELETESUBST/DX::END把上
BAT批处理判断IP地址并自动禁用启用网卡
某内网拨号软件设计问题,拨号后在偶然的情况下不能自动获取DHCP从而更新内网IP,后来发现通过手动释放和重新获取IP可以解决这个问题,但是每次在
编辑:一起学习网
标签:本地连接,地址,命令,网卡,网关