views:

520

answers:

2

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?

A: 

Use the system command, like in

ruby -e 'system "ipconfig"'
wallenborn
+3  A: 

From IRB:

system "start text_file.txt"

From a shell:

ruby -e 'system "start text_file.txt"'
JRL
Thanks for this 'start' word
gmile