Calling a Windows .bat file from Ruby program

I want to call a Windows .bat file from inside my Ruby program and I
can’t find any documentation on how to do this.

Thanks for your help

John Reed
colotechpro@yahoo.com

John Reed wrote:

I want to call a Windows .bat file from inside my Ruby program and I
can’t find any documentation on how to do this.

batchfile.bat should work.

colotechpro@yahoo.com (John Reed) wrote:

I want to call a Windows .bat file from inside my Ruby program and I
can’t find any documentation on how to do this.

http://www.rubycentral.com/book/tut_threads.html

Cheers
Sascha

John Reed wrote:

I want to call a Windows .bat file from inside my Ruby program and I
can’t find any documentation on how to do this.

To run a batch file just run the command processor and passing the
batch file as an argument:

cmd.exe /C the_batch_file.cmd

The /C option means carry out the command specified and terminate.

If you are running Windows 95, 98 or Me you need to run command.com
and name your file with a bat file extension. If you are running
Windows NT, 2000, xp you should run cmd.exe and the batch file
should have a cmd file extension.

Jussi Jumppanen
Author of: Zeus for Windows (All new version 3.92 out now)
“The C/C++, Java, Python, PHP, Perl, Ruby programmer’s editor”
Home Page: http://www.zeusedit.com

wsdng@onlinehome.de (Sascha D?rdelmann) wrote in message news:a39cf4fe.0403080154.3ff8cef4@posting.google.com

···

colotechpro@yahoo.com (John Reed) wrote:

I want to call a Windows .bat file from inside my Ruby program and I
can’t find any documentation on how to do this.

http://www.rubycentral.com/book/tut_threads.html

Cheers
Sascha

Thanks for the help. I got it to work.

John

Jussi Jumppanen wrote:

John Reed wrote:

I want to call a Windows .bat file from inside my Ruby program and I
can’t find any documentation on how to do this.

To run a batch file just run the command processor and passing the
batch file as an argument:

cmd.exe /C the_batch_file.cmd

The /C option means carry out the command specified and terminate.

If you are running Windows 95, 98 or Me you need to run command.com
and name your file with a bat file extension. If you are running
Windows NT, 2000, xp you should run cmd.exe and the batch file
should have a cmd file extension.

I’m not near a windows box to test right now, but wouldn’t

system “start file.bat”

work in all cases?

Hi,

At Fri, 12 Mar 2004 02:35:09 +0900,
Joel VanderWerf wrote in [ruby-talk:94737]:

I’m not near a windows box to test right now, but wouldn’t

system “start file.bat”

work in all cases?

We expect so, and unless you want to detach the batch process,
you don’t need “start”, just

system “file.bat”

would work on both of NT and 9X.

···


Nobu Nakada