window网卡快捷重启脚本

一、完整脚本复制另存,格式为ANSI。命名举例:

​ Vm8net-Reset重启虚拟卡ANSI.bat

​ 代码:


%1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c %~s0 ::","","runas",1)(window.close)&&exit
@echo off
echo "测试退出"
timeout /t 1
@echo off

cd /d %~dp0
@echo off
echo VMnet8、Hostonly
netsh interface set interface "VMware Network Adapter VMnet8" disable
:: netsh interface set interface "VirtualBox Host-Only Network" disable
echo 网卡已关闭(以管理员方式运行的...)
netsh interface set interface "VMware Network Adapter VMnet8" enabled
:: netsh interface set interface "VirtualBox Host-Only Network" enabled
echo 网卡重启成功
@echo off
timeout /t 1
exit

二、创建快捷方法,到用户目录下

​ C:\Users\32974

​ 方便快速启动。

三、参考链接:

​ 1.https://blog.csdn.net/weixin_44288604/article/details/135219373?utm_medium=distribute.pc_relevant.none-task-blog-2defaultbaidujs_baidulandingword~default-1-135219373-blog-90033786.235v43pc_blog_bottom_relevance_base5&spm=1001.2101.3001.4242.2&utm_relevant_index=2

​ 2.bat 注释说明:

https://blog.csdn.net/tiandyoin/article/details/107219226

​ 3、权限参考:

https://blog.csdn.net/zx493734247/article/details/138557250

四、细节问题说明:

​ 1、执行显示乱码。需改格式ANSI。

​ 2、需加入特别语句,用管理员权限启动脚本。

posted @ 2024-07-22 13:52  太平东路  阅读(38)  评论(0编辑  收藏  举报