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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Tue, Jan 6, 2009 at 11:07 AM, Ryan Mckenzie < rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > 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. >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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan Mckenzie wrote:> 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'') >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. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ryan - On 6-Jan-09, at 3:59 PM, Ryan Mckenzie wrote:> > 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, > McKenzielikely env issue - echo the path in the bat file. you might need to set the path correctly @ the top J --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---