Shell 从 Ruby 执行 [英] Shell execute from Ruby

查看:40
本文介绍了Shell 从 Ruby 执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设,我的 .rb 脚本中有一个文件text_file.txt".如何从 Ruby 执行该文件的默认 Windows 程序?

Assume, I have a file 'text_file.txt' within my .rb script. How do I execute a default windows program for that file from the Ruby?

推荐答案

来自 IRB:

system "start text_file.txt"

来自外壳:

ruby -e 'system "start text_file.txt"'

这篇关于Shell 从 Ruby 执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆