Getting values using wmic
wmic computersystem get /value
Displays all computer system values as list
=================================
The below wmi command gives the OS and the service pack version.
wmic os get Caption,CSDVersion /value
Output:
Caption=Microsoft Windows 7 Enterprise
CSDVersion=Service Pack 1
==========================
Filtering with "where":
wmic logicaldisk where drivetype=3 get description,name
Ref:
http://www.cryer.co.uk/brian/windows/batch_files/how_to_list_drive_letters.htm
https://ss64.com/nt/wmic.html
In a batch file:
@echo off
for /f "tokens=2 delims==" %%d in ('wmic logicaldisk where "drivetype=3" get name /format:value') do echo %%d
Displays all computer system values as list
=================================
The below wmi command gives the OS and the service pack version.
wmic os get Caption,CSDVersion /value
Output:
Caption=Microsoft Windows 7 Enterprise
CSDVersion=Service Pack 1
==========================
Filtering with "where":
wmic logicaldisk where drivetype=3 get description,name
Ref:
http://www.cryer.co.uk/brian/windows/batch_files/how_to_list_drive_letters.htm
https://ss64.com/nt/wmic.html
In a batch file:
@echo off
for /f "tokens=2 delims==" %%d in ('wmic logicaldisk where "drivetype=3" get name /format:value') do echo %%d
Comments
Post a Comment