Bat 啟動網卡

開啟網卡

netsh interface set interface name="乙太網路" admin=enable

關閉網卡

netsh interface set interface name="乙太網路" admin=disabled

以管理員權限執行

因為這些操作需要管理員權限

在程式碼最前面此程式碼就可以了

%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit

完整程式碼

@echo off
%1 start "" mshta vbscript:createobject("shell.application").shellexecute("""%~0""","::",,"runas",1)(window.close)&exit
echo 網卡啟動中....
netsh interface set interface name="乙太網路" admin=enable
echo 啟動成功
Last modification:March 2nd, 2020 at 03:40 pm