摆脱wmic输出中的空格和制表符 [英] Get rid of spaces and tabs in wmic output

查看:191
本文介绍了摆脱wmic输出中的空格和制表符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用批处理,尝试获取以下命令的输出:

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:

推荐答案

WMIC的输出是unicode,文件中两个字节的unicode字符中的空格"为null.尝试

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输出中的空格和制表符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆