Just need a clue


#1

Hi,

I want to replace some DOS batch scripts with Ruby scripts.

Could you give me a clue how can I execute a .EXE file within Ruby
script and also how can I check the errorlevel?

Any help would be appreciated,
Alan


#2

Alan wrote:

Hi,

I want to replace some DOS batch scripts with Ruby scripts.

Could you give me a clue how can I execute a .EXE file within Ruby
script and also how can I check the errorlevel?

Any help would be appreciated,
Alan

See the various Kernel methods, such as system:

http://www.ruby-doc.org/core/classes/Kernel.html#M002992

“Executes cmd in a subshell, returning true if the command was found and
ran successfully, false otherwise. An error status is available in $?.
The arguments are processed in the same way as for Kernel::exec.”


#3

On May 1, 2006, at 11:22 PM, Alan wrote:


Posted via http://www.ruby-forum.com/.

system(“some.exe”)
puts $? # will contain the exit code