win7 批处理更改IP方法?

win7 批处理更改IP方法?,第1张

@echo off

netsh interface ip set address name="本地连接" source=static addr=10.10.10.1 mask=255.255.255.0

netsh interface ip set address name="本地连接" gateway=110.10.10.2 gwmetric=0

netsh interface ip set dns name="本地连接" source=static addr=10.10.10.3 register=PRIMARY

netsh interface ip add dns name="本地连接" addr=10.10.10.4

netsh interface ip set wins name="本地连接" source=static addr=none

第二行:设置本地连接的ip地址为:10.10.10.1,子网掩码为:255.255.255.0

第三行:设置网关为110.10.10.2

第四行:设置主dns为10.10.10.3

第五行:设置备份dns为10.10.10.4

如果你只更改ip,留第二行就行了.

PS:"本地连接"你是的连接名称,你的是啥名称就改为啥,一般默认是"本地连接"..

@echo

off

echo

"请输入1,IP修改为:192.168.1.221"

echo

"请输入2,IP修改为:192.168.0.221"

set

/p

var="请选择需要设置的IP[1或2]:"

if

%var%==1

(

netsh

interface

ip

set

address

本地连接

static192.168.1.221

255.255.255.0

192.168.1.1

1

netsh

interface

ip

set

dns

本地连接

static

218.6.200.139

primary

netsh

interface

ip

add

dns

本地连接

61.139.2.69

)

if

%var%==2

(

netsh

interface

ip

add

address

本地连接

192.168.0.221

255.255.255.0

192.168.0.1

1

netsh

interface

ip

set

dns

本地连接

static

218.6.200.139

primary

netsh

interface

ip

add

dns

本地连接

61.139.2.69

)

1、首先你确保Netsh命令无误

2、Netsh命令是系统级命令,需要管理员权限

3、在你的批处理命令上右键-以管理员身份运行,试试看。

4、另外查查你无线网卡名称“无线网络连接”是否正确。可以参考这个“知道”

http://zhidao.baidu.com/question/217617212.html


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/tougao/6804716.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-03-28
下一篇 2023-03-28

发表评论

登录后才能评论

评论列表(0条)

保存