本帖最后由 yakeyun 于 2022-4-25 19:37 编辑
回复 1# 深蓝幻灭
记得保存为ANSI格式执行- @echo off
- %1 %2
- ver|find "5.">nul&&goto :Admin
- mshta vbscript:createobject("shell.application").shellexecute("%~s0","goto :Admin","","runas",1)(window.close)&goto :eof
- :Admin
- setlocal enabledelayedexpansion
- title 主板禁用网卡设备信息获取中请稍等...
- cd /d "%~dp0
- for /f "tokens=1 delims=:" %%a in ('echo ^|pnputil /enum-devices /class net ^|findstr /n "已禁用"') do (
- set op=%%a
- set /a op5=!op!-6
- set /a op4=!op!-5
- )
- if not defined op (echo 未找到禁用网卡设备,5秒后窗口自动关闭!& timeout -t 5 >nul & exit)
- for /f "skip=%op5% tokens=3" %%e in ('echo ^|pnputil /enum-devices /class net') do (
- set /a m+=1
- if !m! equ 1 (
- set id=%%e
- )
- )
- for /f "skip=%op4% tokens=2,*" %%i in ('echo ^|pnputil /enum-devices /class net') do (
- set /a n+=1
- if !n! equ 1 (
- set name=%%i %%j
- )
- )
- pnputil /enable-device "!id!"
- cls
- for /f "tokens=*" %%n in ('wmic nic get macaddress ^,Name ^|find /i "!name!"') do (
- set MACname=%%n
- pnputil /disable-device "!id!"
- )
- cls
- for /f "tokens=1,*" %%s in ('echo !MACname!') do (
- echo 当前禁用网卡信息如下:
- echo.
- echo 网卡设备名称:%%t
- echo 网卡 MAC值:%%s
- echo.
- )
- title 主板禁用网卡设备信息获取工具 By.sanli
- pause>nul
- exit
复制代码
|