Thursday, October 30, 2014

cmd.exe - WMIC Output Result Without Property Name


I'm entering this line:


wmic /OUTPUT:D:\DriverVersion.txt path win32_VideoController get driverversion

The txt file has two lines in it:


VariableValue
XX.XXX.XXX.XX.X

But I don't want VariableValue to get into output. I want simply get the output (XX.XXX.XXX.XX.X)


How can I do this?


Answer



You could try the following:


(@for /F "delims=" %I in ('wmic path Win32_VideoController get DriverVersion /VALUE') do @for /F "tokens=1* delims==" %J in ("%I") do @echo/%K) > "D:\DriverVersion.txt"

But this converts the Unicode output data to ASCII/ANSI.


If you want to use this code within a , ensure to double all %-signs.


No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...