2009-10-06 7 views
1

Supposons que j'ai un fichier 'text_file.txt' dans mon script .rb. Comment puis-je exécuter un programme Windows par défaut pour ce fichier à partir du Ruby?Shell exécuter à partir de Ruby

Répondre

4

De la CISR:

system "start text_file.txt" 

A partir d'une coquille:

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

Merci pour ce mot 'start' – gmile

0

Utilisez la commande system, comme dans

ruby -e 'system "ipconfig"' 
Questions connexes