永发信息网

批处理修改IP设置,IP无法写入

答案:1  悬赏:40  手机版
解决时间 2021-04-05 00:47
  • 提问者网友:溺爱和你
  • 2021-04-04 01:15
批处理修改IP设置,IP无法写入
最佳答案
  • 五星知识达人网友:廢物販賣機
  • 2021-04-04 02:33
@echo off

set /p aa=请选择[序号]:
echo 1、自动获得IP
echo 2、固定IP
if "aa"=="1" goto n1
if "aa"=="2" goto n2

:n2
echo  设置IP地址中....
netsh interface ipv4 set address "本地连接" static  192.168.1.140 255.255.255.0 192.168.1.147
netsh interface ip  set  address "本地连接" static  192.168.1.140 255.255.255.0 192.168.1.147
netsh  interface ipv4  set  dns "本地连接" static 8.8.8.8
netsh  interface ip  set  dns "本地连接" static 8.8.4.4
echo 设置完成


:n1
echo  自动获取IP地址....
netsh interface ip set address name = "本地连接" source = dhcp
echo  自动获取DNS服务器....
netsh interface ip set dns name = "本地连接" source = dhcp
Echo 自动获取IP成功,按任一键后,就可以使用外网了……
Pause



pause追问我是想知道为什么我的代码不能成功,谢谢
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯