Newbie: Problem with irb

Check the header for C:\RUBY\BIN\IRB.BAT (or erb or rdoc .bat files).
Should look like:

@echo off
"C:\ruby\bin\ruby.exe" "C:\ruby\bin\irb" %1 %2 %3 %4 %5 %6 %7 %8 %9

the actual top lines are

ruby -Sx "%0" %1 %2 %3 %4 %5 %6 %7 %8 %9

for win9x, and

ruby -Sx "%~nx0" %*

for win nt, then some codes at the bottom. I don't understand what

"%0"

or "%~nx0" actualy do. Care to explain? As for "C:\ruby\bin\ruby.exe"
from your snippet, I think the OS should find it cause it's in the
search path without specifying the absolute path.

"%0" is the zero argument, always the name of the bat file.
"%~nx0" same, but just the name and extension.

Should be "%dpn0" (drive/path/name, no extension). There are erb, irb,
etc ruby scrips in the ruby/bin that will be run.

As for the path, the OS finds ruby.exe, but it in turn cannot find the
appropriate script (erb, irb etc). This is probably because ruby tries
to read from the current dir, which is not where the files are stored.

As I said above, try with "%~dpn0".