开发者

Opening Windows files with ruby?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜