From: Jeremy Bopp Date: 2010-11-01T13:34:40+09:00 Subject: Re: What does ruby.exe do? On 10/31/2010 08:51 PM, Kaye Ng wrote: > Rajinder Yadav wrote in post #958380: >> On 10-10-30 05:34 AM, Kaye Ng wrote: >>> it onto ruby.exe ? >>> >>> Thanks geniuses. >>> >> >> just put "C:\Ruby192\bin" at the end of your path environment, open up >> cmd.exe in the folder where the example lives, and then type >> >> 'ruby.exe example1.rb' >> > > May I ask why 'ruby.exe example1.rb' when 'example1.rb' alone is > sufficient? > beginner here =) no knowledge whatsoever. > > i'm using windows xp, what i do is: > c: > c:\Ruby192\Practice (that's where i keep my sample program) > then type example1.rb > and it works exactly like the 'ruby.exe example1.rb' It works because there must be a file association for files with the .rb extension to be run by ruby.exe. Windows is a bit special in this regard. Unix systems handle associating scripts with programs in a different way that is not supported under Windows. Too bad too, because the Unix way is much more flexible. For instance, I can name a file myscript.jeremy and configure it so that it will be run with Ruby, Python, Perl, or some other interpreter of my choosing. I could then create another file named myotherscript.jeremy and set it up to run using a completely different interpreter. This is not possible under Windows. The .jeremy extension can only be associated with a single program, so one of those files would have to be run by manually calling the correct program with the file as an argument. > but I was just wondering why you suggested that. is it a conventional > way or something? I'm still not sure why ruby.exe exists in the bin > folder, I find testing programs in command prompt a lot easier....and i > don't feel like using SciTE.exe (text editor) either.... The ruby.exe file is the program that runs, or interprets, Ruby scripts on your system. Without ruby.exe, your scripts cannot run. As a quick experiment, rename ruby.exe to ruby.exe.bak and then try running your script. Unless you have a different ruby.exe than the one you renamed configured to run your scripts, you should get a nice error. Keep in mind that none of this is unique to Ruby. If you install Python or Perl, you'll find they have python.exe and perl.exe files in their respective bin directories as well. -Jeremy