Get rid of spaces and tabs in wmic output

白昼怎懂夜的黑 提交于 2019-12-06 01:03:17

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"

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
S Techy Tse

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)
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!