This works for me:
system(“cmd /c C:\path\to\batchfile\batchfile.bat”)
···
-----Original Message-----
From: Joel VanderWerf [mailto:vjoel@PATH.Berkeley.EDU]
Sent: Thursday, March 11, 2004 12:35 PM
To: ruby-talk@ruby-lang.org
Subject: Re: Calling a Windows .bat file from Ruby program
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?