The Wmic.exe command-line utility gathers information from WMI for the local administrator.
NOTE: The first time that you run the Wmic.exe utility, it compiles its' .MOF file.
NOTE: See Windows Management Instrumentation
Sample Usage
To display the local computer name, O/S version, and Service Pack if Windows XP SP2 or greater is installed:@echo off setlocal for /f %%v in ('wmic os get version /value^|find "Version"') do set %%v if "%Version:~0,4%" NEQ "5.1." goto finish for /f %%v in ('wmic os get servicepackmajorversion /value^|find "ServicePackMajorVersion"') do set %%v if "%ServicePackMajorVersion%" LSS "2" goto finish @echo %computername% %Version% %ServicePackMajorVersion% :finish endlocalOn my Windows XP SP2 desktop, the above script displays:
JSI009 5.1.2600 2
0 comments
Hide comments