复制代码
- @echo off&setlocal enableDelayedExpansion
- call :getEnum %~s0 AdapterType
- call :getEnum %~s0 NetConnectionStatus
- call :getEnum %~s0 ConfigManagerErrorCode
- >NIC.TXT 2>nul (
- echo 计算机名: %computername%&echo.&echo IP 可用网卡:
- for /f "tokens=1,2 delims==" %%a in ('wmic nicconfig where "ipenabled='true'" get /value') do (
- set "%%a=%%b"
- if /i "%%a"=="Index" (
- set /a "%%a=%%b"
- for /f "tokens=1,2 delims==" %%x in ('wmic nic where "index=!index!" get /value') do (
- set "%%x=%%y"
- if /i "%%x"=="NetConnectionStatus" for %%z in (%%y) do set "%%x=!%%x%%z!"
- if /i "%%x"=="ConfigManagerErrorCode" for %%z in (%%y) do set "%%x=!%%x%%z!"
- )
- )
- if /i "%%a"=="WINSSecondaryServer" (
- call :getIP IPAddress& call :getIP IPSubnet& call :getIP DefaultIPGateway& call :getIP DNSServerSearchOrder
- echo.
- echo =====================================================
- echo.&echo !NetConnectionID!&echo.
- echo AdapterType . . . . . . . . : !AdapterType!
- echo DNSDomainSuffixSearchOrder. : !DNSDomainSuffixSearchOrder!
- echo Name. . . . . . . . . . . . : !Name!
- echo NetConnectionStatus . . . . : !NetConnectionStatus!
- echo ConfigManagerErrorCode. . . : !ConfigManagerErrorCode!
- echo MACAddress. . . . . . . . . : !MACAddress!
- echo DHCPEnabled . . . . . . . . : !DHCPEnabled!
- echo IPAddress . . . . . . . . . : !IPAddress!
- echo IPSubnet. . . . . . . . . . : !IPSubnet!
- echo DefaultIPGateway. . . . . . : !DefaultIPGateway!
- echo DHCPServer. . . . . . . . . : !DHCPServer!
- set "dnsPrintHead=DNSServerSearchOrder. . . ."
- for %%d in (!DNSServerSearchOrder!) do (
- echo !dnsPrintHead! : %%d
- set "dnsPrintHead= "
- )
- echo DHCPLeaseObtained . . . . . : !DHCPLeaseObtained!
- echo DHCPLeaseExpires. . . . . . : !DHCPLeaseExpires!
- )
- )
- echo.
- echo 非正常工作设备:
- for /f "tokens=1,2 delims==" %%a in ('wmic nic where "ConfigManagerErrorCode>0" get /value') do (
- set "%%a=%%b"
- if /i "%%a"=="NetConnectionStatus" for %%z in (%%b) do set "%%a=!%%a%%z!"
- if /i "%%a"=="ConfigManagerErrorCode" for %%z in (%%b) do set "%%a=!%%a%%z!"
- if /i "%%a"=="TimeOfLastReset" (
- echo.
- echo =====================================================
- echo.&echo !NetConnectionID!&echo.
- echo Name. . . . . . . . . . . . : !Name!
- echo ConfigManagerErrorCode. . . : !ConfigManagerErrorCode!
- echo NetConnectionStatus . . . . : !NetConnectionStatus!
- echo eTimeOfLastReset. . . . . . : !TimeOfLastReset!
- )
- )
- )
- start NIC.TXT
- exit /b
- :getIP
- (set %1=!%1:^"=!&set %1=!%1:{=!&set %1=!%1:}=!)
- exit /b
- :getEnum
- for /f "tokens=1,2* delims= " %%a in (%1) do (
- if /i "!getValue!"=="Y" set "%2%%a=%%c"
- if /i "%%a"==":%2" set getValue=Y
- if /i "%%a"==":end:%2" set getValue=N
- )
- exit /b
- :NetConnectionStatus enum
- 0 (0x0) Disconnected
- 1 (0x1) Connecting
- 2 (0x2) Connected
- 3 (0x3) Disconnecting
- 4 (0x4) Hardware not present
- 5 (0x5) Hardware disabled
- 6 (0x6) Hardware malfunction
- 7 (0x7) Media disconnected
- 8 (0x8) Authenticating
- 9 (0x9) Authentication succeeded
- 10 (0xA) Authentication failed
- 11 (0xB) Invalid address
- 12 (0xC) Credentials required
- :end:NetConnectionStatus enum
- :ConfigManagerErrorCode enum
- 0 (0x0) Device is working properly.
- 1 (0x1) Device is not configured correctly.
- 2 (0x2) Windows cannot load the driver for this device.
- 3 (0x3) Driver for this device might be corrupted, or the system may be low on memory or other resources.
- 4 (0x4) Device is not working properly. One of its drivers or the registry might be corrupted.
- 5 (0x5) Driver for the device requires a resource that Windows cannot manage.
- 6 (0x6) Boot configuration for the device conflicts with other devices.
- 7 (0x7) Cannot filter.
- 8 (0x8) Driver loader for the device is missing.
- 9 (0x9) Device is not working properly. The controlling firmware is incorrectly reporting the resources for the device.
- 10 (0xA) Device cannot start.
- 11 (0xB) Device failed.
- 12 (0xC) Device cannot find enough free resources to use.
- 13 (0xD) Windows cannot verify the device's resources.
- 14 (0xE) Device cannot work properly until the computer is restarted.
- 15 (0xF) Device is not working properly due to a possible re-enumeration problem.
- 16 (0x10) Windows cannot identify all of the resources that the device uses.
- 17 (0x11) Device is requesting an unknown resource type.
- 18 (0x12) Device drivers must be reinstalled.
- 19 (0x13) Failure using the VxD loader.
- 20 (0x14) Registry might be corrupted.
- 21 (0x15) System failure. If changing the device driver is ineffective, see the hardware documentation. Windows is removing the device.
- 22 (0x16) Device is disabled.
- 23 (0x17) System failure. If changing the device driver is ineffective, see the hardware documentation.
- 24 (0x18) Device is not present, not working properly, or does not have all of its drivers installed.
- 25 (0x19) Windows is still setting up the device.
- 26 (0x1A) Windows is still setting up the device.
- 27 (0x1B) Device does not have valid log configuration.
- 28 (0x1C) Device drivers are not installed.
- 29 (0x1D) Device is disabled. The device firmware did not provide the required resources.
- 30 (0x1E) Device is using an IRQ resource that another device is using.
- 31 (0x1F) Device is not working properly. Windows cannot load the required device drivers.
- :end:ConfigManagerErrorCode enum
- :AdapterType enum
- 0 (0x0) Ethernet 802.3
- 1 (0x1) Token Ring 802.5
- 2 (0x2) Fiber Distributed Data Interface (FDDI)
- 3 (0x3) Wide Area Network (WAN)
- 4 (0x4) LocalTalk
- 5 (0x5) Ethernet using DIX header format
- 6 (0x6) ARCNET
- 7 (0x7) ARCNET (878.2)
- 8 (0x8) ATM
- 9 (0x9) Wireless
- 10 (0xA) Infrared Wireless
- 11 (0xB) Bpc
- 12 (0xC) CoWan
- 13 (0xD) 1394
- :end:AdapterType enum
欢迎光临 批处理之家 (http://bathome.net./) | Powered by Discuz! 7.2 |