(view source code of listwmiclasses.bat as plain text)
@ECHO OFF
IF NOT "%OS%"=="Windows_NT" GOTO Syntax
IF NOT "%~1"=="" GOTO Syntax
WMIC /? > NUL 2>&1 || GOTO Syntax
SETLOCAL
:: Clear existing values
FOR %%A IN (CIM MSFT WIN32) DO (
FOR /F "delims==" %%B IN ('SET %%A_ 2^>NUL') DO (
SET %%B=
)
)
:: Collect information on most of the available WMI classes; by using
:: environment variables the data is sorted and deduplicated automatically
FOR /F %%A IN ('WMIC /? ^| FINDSTR /R /B /C:"[A-Z][A-Z][A-Z ][A-Z ][A-Z ][A-Z ][A-Z ][A-Z ][A-Z ][A-Z ][A-Z ][A-Z ]" ^| FINDSTR /R /B /V /C:"For more information"') DO (
FOR /F "tokens=4" %%B IN ('WMIC ALIAS %%A Get Target /Value 2^>NUL ^| FIND "="') DO (
SET %%B=%%B
)
)
:: List the results
FOR %%A IN (CIM MSFT WIN32) DO (
FOR /F "delims==" %%B IN ('SET %%A_') DO (
ECHO.%%B
)
)
ENDLOCAL
GOTO:EOF
:Syntax
ECHO.
ECHO ListWMIClasses.bat, Version 1.01 for Windows XP and later
ECHO List (a tiny fraction of) all WMI classes in the "root\CIMV2" namespace
ECHO.
ECHO Usage: LISTWMICLASSES
ECHO.
ECHO Returns: a sorted list of WMI classes, displayed on screen
ECHO.
ECHO Note: Uses WMIC to list all "Target" classes of available Aliases.
ECHO So WMI classes without alias will not be included in the list.
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.0074 seconds