简体   繁体   English

通过ruby从msinfo32.exe创建报告

[英]create a report from msinfo32.exe via ruby

I would like to silently save out a report from msinfo32.exe using ruby. 我想使用ruby从msinfo32.exe静默保存报告。 How can I do so? 我该怎么办? I tried the following 我尝试了以下

system "msinfo32.exe /\report c:/\/\temp/\/\fromruby.txt"
exec 'msinfo32.exe /\report c:/\/\temp/\/\fromruby.txt'
IO.popen("msinfo32.exe /\report c:/\/\temp/\/\fromruby.txt")

and all of these open the application instead of silently creating the report. 所有这些都将打开应用程序,而不是无提示地创建报告。

Thanks in advance. 提前致谢。

system "msinfo32.exe /\report c:/\/\temp/\/\fromruby.txt"
                      ^^           ^^

\\r is a carriage return, \\t is a tab character, and \\f is a formfeed. \\r是回车符, \\t是制表符, \\f是换页符。 none of those have to be escaped at all in the first place. 首先,这些都不是必须逃脱的。

so instead of executing a single command: 因此,而不是执行单个命令:

msinfo32.exe /report c:\temp\fromruby.txt

you're executing all of these separate commands: 您正在执行所有这些单独的命令:

msinfo32.exe /
eport c://        temp//
romruby.txt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM