|
5#
楼主 |
发表于 2021-5-25 18:52:01
|
只看该作者
本帖最后由 叶知秋 于 2021-5-25 18:53 编辑
谢谢大侠指点,出在可以输出TXT文件了,实在感谢!现在改为
@echo off & color a & title 获取系统信息 ^& By 繁华背后的落寞
setlocal enabledelayedexpansion
Rem 获取系统版本
for /f "delims=" %%a in ('wmic process get^|findstr /i "Microsoft Windows"') do (
set /a a+=1
if !a!==2 (set var=%%a&goto st)
)
:st
for /f "delims=|" %%b in ("!var!") do (
for /f "tokens=19-21" %%i in ("%%b") do (
if "%PROCESSOR_ARCHITECTURE%"=="x86" set var=32位
if "%PROCESSOR_ARCHITECTURE%"=="AMD64" set var=64位
echo 操作系统:%%i %%j %%k !var!
)
)
set var=<nul
echo 当前计算机名:%computername%
echo 当前登陆用户名:%username%
Rem 获取IP地址
for /f "delims=" %%a in ('wmic nicconfig get IPAddress /value ^| findstr /i "IPAddress={"') do (
set var=%%a
for /f tokens^=2^ delims^=^"^" %%b in ("!var!") do (
echo IP地址:%%b
)
)
Rem 获取MAC地址
for /f "skip=3 tokens=1" %%a in ('getmac') do (
echo MAC地址:%%a
goto mac
)
:mac
Rem 获取主板型号
for /f "delims=" %%a in ('wmic BASEBOARD get Manufacturer^,Product^,Version^,SerialNumber /value^|findstr /i "product"') do (
set a=%%a
set a=!a:~0,8!#!a:~8!
set a=!a:*#=!
echo 主板型号:!a!
)
set a=<nul
Rem 获取CPU信息
for /f "delims=" %%a in ('wmic cpu list full^|findstr "GHz"') do (
set a=%%a
set a=!a:~0,5!#!a:~5!
set a=!a:*#=!
echo CPU型号:!a!
)
set a=<nul
set b=<nul
Rem 获取显示器分辨率
for /f "delims=" %%a in ('wmic DESKTOPMONITOR get name^,ScreenWidth^,ScreenHeight^,PNPDeviceID /value^|findstr /i "screenWidth"') do (
set a=%%a
set a=!a:~0,12!#!a:~12!
set a=!a:*#=!
if !a! gtr 1 goto :step4
)
:step4
for /f "delims=" %%b in ('wmic DESKTOPMONITOR get name^,ScreenWidth^,ScreenHeight^,PNPDeviceID /value^|findstr /i "screenHeight"') do (
set b=%%b
set b=!b:~0,13!#!b:~13!
set b=!b:*#=!
if !b! gtr 1 goto :step5
)
:step5
echo 显示器分辨率:%a%x%b%
set a=<nul
set b=<nul
Rem 获取硬盘信息
for /f "delims=" %%a in ('wmic DISKDRIVE get model^,interfacetype^,size^,totalsectors^,partitions /value^|findstr /i "Model"') do (
set a=%%a
set a=!a:~0,6!#!a:~6!
set a=!a:*#=!
echo 硬盘型号:!a!
set /a num1+=1
set num2=0
for /f "delims=" %%b in ('wmic DISKDRIVE get model^,interfacetype^,size^,totalsectors^,partitions /value^|findstr /i "Size"') do (
set /a num2+=1
set b=%%b
set b=!b:~0,5!#!b:~5!
set b=!b:*#=!
set b=!b:~0,-10!
if !num1!==!num2! (set num2=1&echo 硬盘容量:!b!GB&set b=<nul)
)
)
set a=<nul
set b=<nul
Rem 获取硬盘序列号
set "index=0"
for /f "skip=1 delims=" %%a in ('wmic path Win32_PhysicalMedia get SerialNumber') do (
set /a "index+=1"
call set "硬盘序列号_%%index%%=%%a"
)
set 硬盘序列号_
Rem 获取内存信息
for /f "skip=1 tokens=2" %%a in ('wmic os get TotalVisibleMemorySize^,FreePhysicalMemory') do (
set var=%%a
set /a var=!var!/1024
)
echo 内存:!var!M
set var=<nul
Rem 获取显卡信息
for /f "skip=1 delims=" %%a in ('wmic path win32_videocontroller get description') do (
set var=%%a
goto video
)
)
:video
echo 显卡型号:!var!
echo;|123.bat>a.txt
|
评分
-
查看全部评分
|