您好我有一个脚本,它获取系统信息并将信息存储为系统变量,并将详细信息解析为文件夹中的平面文本文件。此信息还让我知道公司中谁拥有什么类型的 Windows、什么类型的计算机以及规格。我唯一缺少的基本上是从机器中获取总物理 RAM,将总物理 RAM 作为系统变量并获取详细的 RAM 信息,例如填充了多少个存储库以及在平面文本文件中有多少 RAM。这是我的脚本,任何帮助将不胜感激。
@if %DEBUG%!==! echo on
setlocal
set prefix=%city%\%location%\ComputerList\
for /f "usebackq tokens=1,2 delims==|" %%I in (`wmic os get name^,version /format:list`) do 2>NUL set "%%I=%%J"
for /f "tokens=2 delims==" %%I in ('wmic bios get version /format:list') do set "bios=%%I"
for /f "tokens=2 delims==" %%I in ('wmic computersystem get model /format:list') do set "model=%%I"
::for /f "tokens=2 delims==" %%I in (systeminfo |find "Total Physical Memory" /format:list) do set "memory=%%I"
>>"%prefix%\%COMPUTERNAME%.txt" echo OS Name: %name%
>>"%prefix%\%COMPUTERNAME%txt" echo OS Version: %version%
>>"%prefix%\%COMPUTERNAME%txt" echo PC Model: %model%
>>"%prefix%\%COMPUTERNAME%txt" echo BIOS Version: %bios%
::>>"%prefix%\%COMPUTERNAME%txt" echo wmic MEMORYCHIP get banklabel, capacity, caption, devicelocator, partnumber
if defined PROGRAMFILES(x86) (set arch=X64) else set arch=X86
if "%name%" neq "%name:Windows 8=%" (
set out=%prefix%\Win8Comps.txt
) else if "%name%" neq "%name:Windows 7=%" (
set out=%prefix%\Win7Comps.txt
) else if "%name%" neq "%name:Windows Vista=%" (
set out=%prefix%\WinVistaComps.txt
) else if "%name%" neq "%name:Windows XP=%" (
set out=%prefix%\WinXPComps.txt
)
>>"%out%" echo %COMPUTERNAME% is running %name% in %arch% environment
:SETX
if exist "%windir%\System32\Setx.exe" (goto Language) else (
xcopy %city%\%location%\Setx.exe %Windir%\System32\Setx.exe
)
:Install_Language
reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "0409" > nul && Set Install_Lang=English
reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "040c" > nul && Set Install_Lang=French_Standard
reg query "hklm\system\controlset001\control\nls\language" /v Installlanguage | FIND "0C0C" > nul && Set Install_Lang=French_Canadian
:Locale_Language
reg query "hklm\system\controlset001\control\nls\language" /ve | FIND "0409" > nul && Set Locale_Lang=English
reg query "hklm\system\controlset001\control\nls\language" /ve | FIND "0c0c" > nul && Set Locale_Lang=French_Standard
:Set_Sys_Variables
Setx -m OS_Name "%name%"
Setx -m Architechture %arch%
Setx -m OS_Version %version%
Setx -m PC_Model %model%
Setx -m Bios_Ver "%bios%"
Setx -m Install_Lang %Install_Lang%
Setx -m Locale_Lang %Locale_Lang%
Setx -m Memory %memory%