(view source code of winsat.bat as plain text)
@ECHO OFF
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
IF NOT "%~3"=="" GOTO Syntax
ECHO.%* | FIND "?" >NUL && GOTO Syntax
SETLOCAL ENABLEDELAYEDEXPANSION
SET Valid=0
FOR %%A IN ("" CPU D3D Disk Graphics Mem Memory Level Total Vid Video) DO (
IF /I "%~1"=="%%~A" SET Valid=1
)
IF NOT "%Valid%"=="1" (
ENDLOCAL
GOTO Syntax
)
IF "%~2"=="" (
SET Node=%ComputerName%
) ELSE (
SET Node=%~2
)
SET RC=
SET WinSATAssessmentState.0=StateUnknown
SET WinSATAssessmentState.1=Valid
SET WinSATAssessmentState.2=IncoherentWithHardware
SET WinSATAssessmentState.3=NoAssessmentAvailable
SET WinSATAssessmentState.4=Invalid
FOR /F "tokens=1* delims==" %%A IN ('WMIC /Node:"%Node%" Path Win32_WinSAT Where TimeTaken^="MostRecentAssessment" Get WinSATAssessmentState /Format:LIST') DO (
IF NOT "%%~B"=="" (
FOR %%C IN (%%~B) DO (
SET Win32_WinSAT.WinSATAssessmentState=!WinSATAssessmentState.%%C!
)
)
)
FOR /F "tokens=1* delims==" %%A IN ('WMIC /Node:"%Node%" Path Win32_WinSAT Where TimeTaken^="MostRecentAssessment" Get WinSPRLevel /Format:LIST') DO (
IF NOT "%%~B"=="" (
SET Result=%%~B
FOR %%C IN ("!Result:,=.!") DO (
SET Win32_WinSAT.WinSPRLevel=%%~C
)
)
)
FOR /F "tokens=1* delims==" %%A IN ('WMIC /Node:"%Node%" Path Win32_WinSAT Where TimeTaken^="MostRecentAssessment" Get * /Format:LIST ^| FINDSTR /R /B /I /C:"%~1[^=]*Score="') DO (
IF NOT "%%~B"=="" (
FOR %%C IN (%%~B) DO IF "!RC!"=="" SET /A RC = %%~C
SET Result=%%~B
FOR %%C IN ("!Result:,=.!") DO (
SET Win32_WinSAT.%%A=%%~C
)
)
)
IF "%~1"=="" SET RC=%Win32_WinSAT.WinSPRLevel%
SET Win32_WinSAT.
ENDLOCAL & EXIT /B %RC%
:Syntax
ECHO.
ECHO WinSAT.bat, Version 1.00
ECHO Return Windows System Assessment Tools's scores for the specified computer
ECHO.
ECHO Usage: WINSAT [ component [ computer ] ]
ECHO.
ECHO Where: "component" can have one of the following values:
ECHO "CPU" to return the WinSAT CPU Score
ECHO "D3D" to return the WinSAT CPU Score
ECHO "Disk" to return the WinSAT Disk Score
ECHO "Graphics", "Vid" or "Video" to return the WinSAT Graphics Score
ECHO "Mem" or "Memory" to return the WinSAT Disk Score
ECHO "Level" or "Total" to return the WinSAT Total Score (WinSPRLevel)
ECHO "computer" is an optional remote computer (default: local computer)
ECHO.
ECHO Notes: If a component is specified, only the score for that component will
ECHO be displayed on screen.
ECHO The integer value for the specified score will be returned as
ECHO "errorlevel".
ECHO If no component is specified, ALL scores will be displayed on screen,
ECHO and the "errorlevel" will be the integer value of the total score.
ECHO.
ECHO Written by Rob van der Woude
ECHO http://www.robvanderwoude.com
IF "%OS%"=="Windows_NT" EXIT /B 1
page last modified: 2024-04-16; loaded in 0.0068 seconds