3

Using batch, trying to get output of the following command:

wmic logicaldisk get caption,description,volumename

Thus, I'm simply doing the following:

wmic logicaldisk get caption,description,volumename >>"C:\out.log"

Unfortunately, this is the output I'm getting:

output

phuclv
  • 37,963
  • 15
  • 156
  • 475
zach
  • 71
  • 1
  • 7

3 Answers3

3

wmic has an output flag that you can use in place of redirect symbols that might work out better for you.

wmic /output:"C:\out.log" logicaldisk get caption,description,volumename
SomethingDark
  • 13,229
  • 5
  • 50
  • 55
  • There is the `/Append` switch that works almost the same as output but it appends. Plus you can specify `clipboard` instead of a file. – Serenity Feb 23 '15 at 12:59
3

The output from WMIC is unicode, your "spaces" are nulls from the two bytes unicode characters in file. Try with

wmic logicaldisk get caption,description,volumename | find /v "" >>"C:\out.log"
MC ND
  • 69,615
  • 8
  • 84
  • 126
0

I had no problem seeing the file, but when doing findstr, I noticed it is not found. So I did the following and it will allow it to produce a regular ASCII text file.

Another solution is to type out the file and do it again

wmic logicaldisk get caption,description,volumename >>"C:\out.log"
type c:\out.log > c:\out1.log
findstr  "your text" out1.log (instead of out.log)
phuclv
  • 37,963
  • 15
  • 156
  • 475