Hello everyone, I'm using InstantRails 2.0 on a Windows XP 32 bit system. I'm developing a Rails application where I would like to execute a .bat file I've had a look around and this piece of code is suppose to do the trick but it does not seem to work. system('path/to/file.bat') Do I need to have some plugins/gems installed? Regards, McKenzie.
on 2009-01-06 17:07
on 2009-01-06 17:38
On Tue, Jan 6, 2009 at 11:07 AM, Ryan Mckenzie < email@example.com> wrote: > > system('path/to/file.bat') > > Do I need to have some plugins/gems installed? > > Regards, > > McKenzie. > No, the #system method is built into Ruby. Can you execute your #system call from the Rails console? $ script/console >> system("/full/path/to/file.bat") ...works for me. --wpd
on 2009-01-06 17:42
Ryan Mckenzie wrote: > system('path/to/file.bat') > Should not need anything special. How do you know it doesn't work? Also, are you using forward slashes in the path? That may not work. Are there spaces in the path to file.bat? That may not work. Cheers, Mohit. 1/7/2009 | 12:41 AM.
on 2009-01-06 21:59
Hi guys, Thanks for your input. I tried using the console and it seems that ruby does not like the content that is in the .bat file for some reason (but the command does work). The bat file contains this line of text which executes a .exe file to open along with the default.ard file as being a model with the other parameters resOp default.ard maxcutset="10" outputtype="XML" If I double click the bat file from windows explorer it runs fine for some reason? Any ideas? Thanks again, McKenzie
on 2009-01-06 22:02
Ryan - On 6-Jan-09, at 3:59 PM, Ryan Mckenzie wrote: > parameters > > resOp default.ard maxcutset="10" outputtype="XML" > > If I double click the bat file from windows explorer it runs fine for > some reason? Any ideas? > > Thanks again, > McKenzie likely env issue - echo the path in the bat file. you might need to set the path correctly @ the top J
on 2009-01-06 23:16
I put in the absolute paths and the bat file executes now but the .exe file displays an output in a new Internet Explorer window. I'm not sure if there is a problem within the .exe file with the .default.ard path being absolute. How would I echo the path in the bat file? Sorry I'm not very firmilar with it. Thanks
on 2009-01-06 23:18
Ryan Mckenzie wrote: > I put in the absolute paths and the bat file executes now but the .exe > file displays an output in a new Internet Explorer window. > Sorry this blank output is different from the expected outcome... the .exe file produces an output file which is then rendered in the Internet Explorer