DOS cmd from .rb file

hi all, i try to invoke some DOS cmd from .rb file but to no avail.
Anyway, can i do that?

Like this?:

ans = %x[dir]
puts ans

Then take a look at:

  • %x

  • system()

  • exec()

  • ``

  • Axel

system(“dir”)

or

result=dir

In the second example those are back ticks (left of the 1 key) not
single quotes.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs