原贴地址:http://www.bathome.net/thread-68226-1-1.html
运行环境,收集局域网内所有电脑配置(批处理放置在共享文件夹内,双击运行之后把生成的电脑配置文件复制到共享文件夹内。)(问题,按任意键保存时批处理不自动关闭。麻烦给修改一下。)- @echo off&setlocal enabledelayedexpansion&title gfd硬件检测_5.3
-
- REM 日期时间
- for /f "tokens=1* delims=:=" %%a in ('"wmic os Get Caption,InstallDate,OSArchitecture,Version /value"') do (
- IF /I "%%a"=="Caption" set Caption=%%b
- IF /I "%%a"=="InstallDate" set InstallDate=%%b
- IF /I "%%a"=="OSArchitecture" set OSArchitecture=%%b
- IF /I "%%a"=="Version" set Version=%%b
- )
- echo 信息提取时间:%date% 时间 %Time%
- echo Windows_信息:%Caption% %Version% 【%OSArchitecture%】 安装日期:%InstallDate:~0,4%年%InstallDate:~4,2%月%InstallDate:~6,2%日_%InstallDate:~8,2%点%InstallDate:~10,2%分%InstallDate:~12,2%秒
- echo.
-
- REM 产品 csproduct
- for /f "tokens=1* delims==" %%a in ('"wmic csproduct Get IdentifyingNumber,Name,Vendor,Version /value"') do (
- IF /I "%%a"=="IdentifyingNumber" set IdenCS=%%b
- IF /I "%%a"=="Name" set NameCS=%%b
- IF /I "%%a"=="Vendor" set VendCS=%%b
- IF /I "%%a"=="Version" set VersCS=%%b
- )
- REM 主板 baseboard
- for /f "tokens=1* delims=:=" %%i in ('"wmic baseboard get Manufacturer,Product,SerialNumber /value"') do (
- IF /I "%%i"=="Manufacturer" set ManuZB=%%j
- IF /I "%%i"=="Product" set ProdZB=%%j
- IF /I "%%i"=="SerialNumber" set SeriZB=%%j
- )
- REM 系统管理 ComputerSystem
- for /f "tokens=1* delims=:=" %%i in ('"wmic ComputerSystem get Manufacturer,SystemFamily,SystemSKUNumber /value"') do (
- IF /I "%%i"=="Manufacturer" set ManuSY=%%j
- IF /I "%%i"=="SystemFamily" set FamiSY=%%j
- IF /I "%%i"=="SystemSKUNumber" set SKUNSY=%%j
- )
- echo 计算机名: %computername%
- echo 主板出厂日期:%ReleaseDate:~0,4%年%ReleaseDate:~4,2%月%ReleaseDate:~6,2%日
- echo 主板型号:%ManuZB% %ProdZB% 序列号:%SeriZB%
-
- REM 处理器
- for /f "tokens=2 delims==" %%a in ('"wmic cpu Get DeviceID /value"') do set /a CPUQuantity+=1
- for /f "tokens=1* delims==" %%a in ('"wmic cpu Get MaxClockSpeed,Name,NumberOfCores,NumberOfLogicalProcessors /value"') do (
- IF /I "%%a"=="MaxClockSpeed" set MaxClockSpeed=%%b
- IF /I "%%a"=="Name" set NameC=%%b
- IF /I "%%a"=="NumberOfCores" set NumberOfCores=%%b
- IF /I "%%a"=="NumberOfLogicalProcessors" set NumberOfLogicalProcessors=%%b
- )
- echo CPU :【%CPUQuantity% 颗】
- echo 名 称:%NameC%【%NumberOfCores%核%NumberOfLogicalProcessors%线程】
-
- REM 内存
- for /f "tokens=2 delims==" %%a in ('"wmic memorychip Get Tag /value"') do set /a MemoryQuantity+=1
- for /f "tokens=2 delims==" %%a in ('"wmic memorychip Get Capacity /value"') do (
- set Capacity=%%a
- set /a NCG=!Capacity:~,-7!/1073
- set /a m+=!NCG!
- )
- for /f "tokens=1* delims==" %%a in ('"wmic memorychip where Tag='Physical Memory 0' Get ConfiguredClockSpeed /value"') do (
- IF /I "%%a"=="ConfiguredClockSpeed" set ConfiguredClockSpeed=%%b
- )
- echo 内存:【%MemoryQuantity% 条】
- echo 总容量:!m! GB 【当前频率:%ConfiguredClockSpeed% MHz】
- echo ----------------------------
- for /f "tokens=1* delims==" %%a in ('"wmic memorychip Get Capacity,Manufacturer,SerialNumber,Speed /value"') do (
- IF /I "%%a"=="Capacity" (
- set Capacity=%%b
- set /a NCG=!Capacity:~,-7!/1073
- set /a NC+=1
- echo. 内存!NC! :%NCG% GB)
- IF /I "%%a"=="Manufacturer" (
- echo. 品 牌:%%b)
- IF /I "%%a"=="SerialNumber" (
- echo. 序 列 号:%%b)
- IF /I "%%a"=="Speed" (
- echo. 最高频率:%%b
- echo ----------------------------)
- )
- echo.&echo.
-
- REM 硬盘
- for /f "tokens=2 delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' Get Caption /value"') do set /a DiskQuantity+=1
- echo 硬盘:【%DiskQuantity% 块】
- for /f "tokens=1* delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' Get Model,SerialNumber,Size /value"') do (
- IF /I "%%a"=="Model" (
- set /a YP+=1
- echo. 硬盘 !YP!:%%b)
- IF /I "%%a"=="SerialNumber" (
- echo. 序列号:%%b)
- IF /I "%%a"=="Size" (
- set Size=%%b
- echo. 容 量:!Size:~,-10! GB
- echo ----------------------------)
- )
- echo.&echo.
-
- REM BIOS
- for /f "tokens=1* delims=:=" %%a in ('"wmic bios Get BIOSVersion,Manufacturer,Name,ReleaseDate,SerialNumber,SMBIOSBIOSVersion,Version /value"') do (
- IF /I "%%a"=="ReleaseDate" set ReleaseDate=%%b
- IF /I "%%a"=="SerialNumber" set SeriBI=%%b
- IF /I "%%a"=="Manufacturer" set ManuBI=%%b
- IF /I "%%a"=="Name" set NameBI=%%b
- IF /I "%%a"=="Version" set VersBI=%%b
- IF /I "%%a"=="BIOSVersion" set BIOSVersion=%%b
- IF /I "%%a"=="SMBIOSBIOSVersion" set SMBIOSBIOSVersion=%%b
- )
- echo.
-
- echo 信息提取完成,按任意键保存到文本中。
- pause>nul
-
- REM ==========保存信息到文件中,如果不需要,删除下面所有==========
- set dept=部门名-测试名
- (echo 信息提取时间:%date% 时间 %Time%
- echo Windows_信息:%Caption% %Version% 【%OSArchitecture%】 安装日期:%InstallDate:~0,4%年%InstallDate:~4,2%月%InstallDate:~6,2%日_%InstallDate:~8,2%点%InstallDate:~10,2%分%InstallDate:~12,2%秒
- echo.
- echo 计算机名: %computername%
- echo 主板出厂日期:%ReleaseDate:~0,4%年%ReleaseDate:~4,2%月%ReleaseDate:~6,2%日
- echo 主板型号:%ManuZB% %ProdZB% 序列号:%SeriZB%
- echo.)>>"!dept!-%computername%.txt"
- echo CPU :【%CPUQuantity% 颗】>>"!dept!-%computername%.txt"
- echo 名 称:%NameC%【%NumberOfCores%核%NumberOfLogicalProcessors%线程】>>"!dept!-%computername%.txt"
- echo.>>"!dept!-%computername%.txt"
- echo 内存:【%MemoryQuantity% 条】>>"!dept!-%computername%.txt"
- echo 总容量:%m% GB 【当前频率:%ConfiguredClockSpeed% MHz】>>"!dept!-%computername%.txt"
- echo ---------------------------->>"!dept!-%computername%.txt"
- for /f "tokens=1* delims==" %%a in ('"wmic memorychip Get Capacity,Manufacturer,SerialNumber,Speed /value"') do (
- IF /I "%%a"=="Capacity" (
- set CapaTXT=%%b
- set /a NCG=!CapaTXT:~,-7!/1073
- set /a NCTXT+=1
- echo. 内存!NCTXT! :%NCG% GB>>"!dept!-%computername%.txt")
- IF /I "%%a"=="Manufacturer" (
- echo. 品 牌:%%b>>"!dept!-%computername%.txt")
- IF /I "%%a"=="SerialNumber" (
- echo. 序 列 号:%%b>>"!dept!-%computername%.txt")
- IF /I "%%a"=="Speed" (
- echo. 最高频率:%%b>>"!dept!-%computername%.txt"
- echo ---------------------------->>"!dept!-%computername%.txt"))
- (echo.
- echo 硬盘:【%DiskQuantity% 块】)>>"!dept!-%computername%.txt"
- for /f "tokens=1* delims==" %%a in ('"wmic DiskDrive where MediaType='Fixed hard disk media' Get Model,SerialNumber,Size /value"') do (
- IF /I "%%a"=="Model" (
- set /a YPTXT+=1
- echo. 硬盘 !YPTXT!:%%b>>"!dept!-%computername%.txt")
- IF /I "%%a"=="SerialNumber" (
- echo. 序列号:%%b>>"!dept!-%computername%.txt")
- IF /I "%%a"=="Size" (
- set Size=%%b
- echo. 容 量:!Size:~,-10! GB>>"!dept!-%computername%.txt"
- echo ---------------------------->>"!dept!-%computername%.txt"))
- (echo.
- echo ****************************************页尾****************************************
- )>>"!dept!-%computername%.txt"
- xcopy /s /y c:\windows\%dept%-%computername%.txt \\win2008r2\硬件信息\
- echo.&echo 已保存,稍后自动退出。&echo.
- timeout /T 3 >nul
复制代码
|