1.创建一个txt文件,并把贴入如下代码:
把网卡设置ip为192.168.1.10 掩码255.255.255.0 网关192.168.1.0
@echo off%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exitcd /d "%~dp0"netsh interface ip set address "ethernet2" static 192.168.1.10 255.255.255.0 192.168.1.0
文章插图
把网卡设置为动态获取ip
@echo off%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exitcd /d "%~dp0"netsh interface ip set address "ethernet2" source=dhcp
文章插图
贴入上述代码之后,把TXT文件修改文件类型为bat,并保存 。接着把你想要更改的哪个网卡名字改为"ethernet2",或者把脚本中的ethernet2改成你的网卡名字,最好网卡名字命名为英文 。中文有可能出现乱码,无法识别 。
之后就可直接双击这个脚本来自动修改网卡ip了
【Windows下bat脚本修改网卡ip】
推荐阅读
- MyBatis 使用数组作为参数,这里藏着一个大坑
- 当下最火的前端面试题,回溯算法来了
- 一点隐私都没有了?聊天记录打码也不安全:大神亲自下场破解
- Android 13 虚拟化技术支持安装 Windows 和 Linux 操作系统
- 科比·布莱恩特|科比总决赛1次砍下40+,乔丹6次,詹姆斯呢?没对比就没伤害
- 丝路红茶叶,道通天下茯茶的功效与作用
- 电脑产品密钥Windows10在哪里查看
- Ps Adobe Photoshop2022软件下载安装教程
- macOS修改图标的一种简单方法
- 喝剩下的红茶渣作用,女生喝红茶的功效与作用