gpt4 book ai didi

windows - WMIC.bat 文件无法正确导出/输出

转载 作者:可可西里 更新时间:2023-11-01 11:49:21 26 4
gpt4 key购买 nike


我正在尝试在 CMD 中运行一个包含以下内容的批处理文件,

wmic csproduct
wmic cpu get name
wmic diskdrive get model,size
ipconfig /all

当我将其复制并粘贴到 CMD 中时,我能够看到命令运行。我成功地能够毫无问题地将所有数据复制并粘贴到文本文档中。

问题:当我尝试将这个确切的文件导出/输出到 .txt 或 .rtf 时,

C:> 1.bat > 1.txt

“ipconfig”正确拉动,但 WMIC 命令不给我任何问题并正确输出到文件。但是,无论我将此批处理导出/输出为 .txt 还是 .rtf,

WMIC 命令在输出文件中的每个字符之间留下空格或 NUL。

我将打开读取的文件

C:\Windows\system32>wmic csproduct C a p t i o n D e s c r i p t i o n I d e n t i f y i n g N u m b e r N a m e S K U N u m b e r U U I D V e n d o r V e r s i o n
C o m p u t e r S y s t e m P r o d u c t C o m p u t e r S y s t e m P r o d u c t T o b e f i l l e d b y O . E . M . T o b e f i l l e d b y O . E . M . C D 4 A E B A 0 - B 7 4 F - 1 2 D C - 8 F B A - 6 0 A 4 4 D 6 3 9 A B E T o b e f i l l e d b y O . E . M . T o b e f i l l e d b y O . E . M .
C:\Windows\system32>ipconfig /all

Windows IP Configuration

Host Name . . . . . . . . . . . . : octocore
Primary Dns Suffix . . . . . . . :
...etc...etc

有没有办法导出/输出这个“组合批处理”,以便正确拉取?

附言我试图阅读 [ https://superuser.com/questions/812438/combine-batch-wmic-ansi-unicode-output-formatting][1] ,但我的问题实际上包含来自一个批处理文件的 wmic 和 native 命令。

[1]: https://superuser.com/questions/812438/combine-batch-wmic-ansi-unicode-output-formatting

附言这是我在 StackOverflow 中的第一篇文章,在此先感谢您! :)

最佳答案

WMIC 输出为 unicode。将每个 wmic 输出通过管道传输到 more

>> 创建一个新文件。>> 如果文件不存在则创建一个新文件,如果文件存在则追加 .

所以,治愈似乎是

wmic csproduct | more
wmic cpu get name | more
wmic diskdrive get model,size | more
ipconfig /all

关于windows - WMIC.bat 文件无法正确导出/输出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34075745/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com