Forum: Ruby DOS cmd from .rb file

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ccb38d07b9c3da02f1e12edc8cb26d6b?d=identicon&s=25 Xx Xx (confusian)
on 2008-12-12 03:48
hi all, i try to invoke some DOS cmd from .rb file but to no avail.
Anyway, can i do that?
86ac8ee8e474b775b482c24b9846a624?d=identicon&s=25 unknown (Guest)
on 2008-12-12 08:45
(Received via mailing list)
Like this?:

ans = %x[dir]
puts ans

Then take a look at:
- %x
- system()
- exec()
- ``

- Axel
Ad97b577f331ae29ed90da5751f2e44f?d=identicon&s=25 Dan Diebolt (dandiebolt)
on 2008-12-12 18:18
(Received via mailing list)
system("dir")

or

result=`dir`

In the second example those are back ticks (left of the 1 key) not
single quotes.
This topic is locked and can not be replied to.