tags:

views:

25

answers:

2

I see in a lot of the tutorials and how to pages, they use the following, or something similar

ruby C:\test.rb

Which would parse test.rb to the interpreter and ... execute the script. But how is this done a on a windows? Ruby isn't a recognized internal command (as per the DOS output)?

I know how to do all these things on Linux, and its as simple as... alas Windows is completely confusing at times :)

+2  A: 

Your best bet is going to be to add the path to the Ruby executable to your Environment Variables:

  1. Right click on 'Computer' in Windows.

  2. Click 'Properties...'

  3. Select the 'Advanced' tab.

  4. Click 'Environment Variables'

  5. Find 'Path' in the list and click edit

  6. Add C:\Ruby\bin; (or wherever you installed Ruby to) to the end of the string

Justin Niessner
A: 

In Windows, you could add the directory which contains ruby.exe to the System-Variable Path, then the above should work. See here for a small tutorial (btw. the directories are separated by ; (semicolon), not by : as in UNIX).

Also possible

cd \Path\To\Ruby\Interpreter
ruby.exe C:\test.rb

since . (the current working directory) is always part of Path.

Johannes Weiß
Cheers, that worked :)
Daniel