- @ECHO OFF&Setlocal EnableDelayedExpansion
- set _Name=计算机名----&set _Domain=工作组------&set _IPAddress=IP地址------
- set _IPSubnet=子网掩码----&set _DefaultIPGateway=网关--------&set _DNSServerSearchOrder=DNS---------
- FOR /F "tokens=*" %%A IN ('WMIC Path Win32_ComputerSystem Get Domain^,Name /Value 2^>Nul') DO (
- FOR /F "tokens=*" %%i in ("%%A") do set %%i
- )
- FOR /F "tokens=*" %%A IN ('WMIC NICConfig WHERE "IPEnabled=TRUE" GET DefaultIPGateway^,Description^,DNSServerSearchOrder^,IPAddress^,IPSubnet /value 2^>Nul') DO (
- FOR /F "tokens=*" %%i in ("%%A") do set %%i
- )
-
- for %%i in (Name Domain IPAddress IPSubnet DefaultIPGateway DNSServerSearchOrder) do (
- set %%i=!%%i:{=!
- set %%i=!%%i:}=!
- set %%i=!%%i:"=!
- echo !_%%i!: !%%i:,= !
- )
-
- @echo off&setlocal enabledelayedexpansion
- echo.&echo.
- for /f "skip=1 tokens=1,* delims= " %%a in ('wmic nic where ^(adaptertype like "ethernet ___._" and netconnectionstatus^="2"^) get name^,macaddress') do (set /A N+=1&set _!N!MAC=%%a&call echo.[!N!] %%b %%a)
- echo.&echo.
- IF !N! EQU 1 set MAC_=!_1MAC!&goto :loop
-
- wmic DISKDRIVE get SerialNumber /value
-
-
- pause>nul
复制代码 这是输出结果
计算机名----: WIN7-64825
工作组------: WORKGROUP
IP地址------: 192.168.10.130
子网掩码----: 255.255.255.0 64
网关--------: 192.168.10.1
DNS---------: 114.114.114.114
[1] Sangfor FastIO Ethernet Adapter 68:01:28:00:EF:69
[2]
SerialNumber=343238333039
SerialNumber=343238333039
求大神帮忙改下输出结果能排版最好如这样:
计算机名----: WIN7-64825
工作组------: WORKGROUP
IP地址------: 192.168.10.130
子网掩码----: 255.255.255.0 64
网关--------: 192.168.10.1
DNS---------: 114.114.114.114
MAC地址:****
硬盘序列号:**** |