开发者

Opening Windows files with ruby?

开发者 https://www.devze.com 2023-02-17 01:48 出处:网络
Is it possible to open files (XML, Word) on windows (In the default program)? I am using windows 7 and the latest ruby version (1.9.2).开发者_如何转开发Try using a \"system\" call to run the \"start\"

Is it possible to open files (XML, Word) on windows (In the default program)? I am using windows 7 and the latest ruby version (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.


If you're wanting your Ruby script to open Word files and manipulate them, then you may want to look into the win32ole library.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号