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
1
A
Répondre
4
De la CISR:
system "start text_file.txt"
A partir d'une coquille:
ruby -e 'system "start text_file.txt"'
0
Utilisez la commande system
, comme dans
ruby -e 'system "ipconfig"'
Questions connexes
- 1. Comment exécuter des scripts shell à distance à partir de pages ASP?
- 2. Groovy exécuter « cp * » commande shell
- 3. Entrée à partir du script shell
- 4. Comment exécuter ShellExecute sur l'objet shell clsid?
- 5. sortie couleur de commande shell dans Ruby
- 6. Comment exécuter un script shell sur une machine distante à partir de Java?
- 7. Exécution indépendante de scripts shell à partir d'une application Java
- 8. Exécuter une bibliothèque Ruby à partir de la ligne de commande
- 9. Comment shell exécuter un fichier en C#?
- 10. exécuter caspol à partir de vbscript
- 11. exécuter php à partir de Java
- 12. Exécuter un programme à partir de MemoryStream
- 13. Exécuter JSP directement à partir de Java
- 14. Comment exécuter des tests d'instrumentation Android à partir d'Eclipse?
- 15. Comment exécuter un logiciel serveur arbitraire à partir d'Eclipse?
- 16. Exécuter unittest.main() à partir d'un module?
- 17. Exécuter le script de connexion à partir de l'application .NET
- 18. Exécuter des commandes de terminal à partir de l'application GUI?
- 19. javascript (spidermonkey) comment exécuter une commande linux depuis js shell?
- 20. Programmation shell: Exécuter deux applications en même temps
- 21. Comment faire emacs shell exécuter le fichier init automatiquement?
- 22. Comment faire pour exécuter le script tcl à partir de PHP?
- 23. Comment rediriger stdin à partir d'un script shell vers une commande dans le script shell?
- 24. Comment exécuter/ShellExecuteEx/InvokeCommand ITEMIDLIST pointant vers des objets Shell?
- 25. Programmation ruby à partir d'un navigateur Web
- 26. Capistrano: exemple de shell
- 27. Exécution d'un fichier jar à partir d'un script shell
- 28. Appel d'un script shell à partir d'une application Groovy/Grails
- 29. Comment exécuter T-SQL à partir de C#?
- 30. Comment exécuter un script PowerShell à partir de SSIS
Merci pour ce mot 'start' – gmile