[英]Opening Windows files with ruby?
Is it possible to open files (XML, Word) on windows (In the default program)? 是否可以在Windows(默认程序)中打开文件(XML,Word)? I am using windows 7 and the latest ruby version (1.9.2).
我正在使用Windows 7和最新的ruby版本(1.9.2)。
Try using a "system" call to run the "start" command, like so: 尝试使用“系统”调用来运行“启动”命令,如下所示:
system("start hello.doc") # Should launch MS Word.
system("start file.xml") # Should launch an XML viewer.
如果您想让Ruby脚本打开Word文件并对其进行操作,则可能需要研究win32ole库。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.