# Release: a "which" command written in ruby--very useful for windows users at least

**URL:** <https://www.ruby-forum.com/t/release-a-which-command-written-in-ruby-very-useful-for-windows-users-at-least/173887>\
**Category:** Ruby\
**Created:** [August 17, 2009, 7:11pm UTC](https://www.ruby-forum.com/t/release-a-which-command-written-in-ruby-very-useful-for-windows-users-at-least/173887 "2009-08-17T19:11:23Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [August 17, 2009, 7:11pm UTC](https://www.ruby-forum.com/t/release-a-which-command-written-in-ruby-very-useful-for-windows-users-at-least/173887/1 "2009-08-17T19:11:23Z")

</div>

Announcing the release of “ruby which”[1]

README:  
Ruby-which is the linux “which” command re-written in ruby [and  
windows-friendly].

– An executable locator (which command) for windows that actually  
works!

There seems to be a lack of a “which” command for windows that  
actually work–they sometimes skip batch files entirely [batch file?  
what’s that?] or don’t list extensions, leaving you in doubt. Despite  
running “which yyy” you never know what you’re really running when you  
next run yyy in the command line–is it yyy.exe or some other yyy.bat  
that wasn’t reported by “which”?

Try it–you might really like it.

To install:

C:\>gem install rogerdpack-whichr

C:\>whichr executable\_name\_here [extension can be included, but is  
optional]

usage:

C:\>whichr ruby  
higher in the list will be executed first  
./ruby.bat  
C:/Ruby/bin/ruby.exe  
c:/cygwin/bin/ruby.exe

Feedback welcome rogerdpack on github/gmail  
[1] not to be confused with this  
witch…[- YouTube](http://www.youtube.com/watch?v=vGm7DLMhQxo)

Also Related: [GitHub - Pistos/ruby-which: Like the UNIX "which" tool, but for Ruby libraries.](http://github.com/Pistos/ruby-which) – this library  
discovers the location of installed ruby libraries, i.e. which gem  
folder they’re in  
“C:\>rwhich ruby-which  
c:/ruby/lib/ruby/gems/1.9.1/gems/Pistos-ruby-which-0.5.3/lib/ruby-which.rb”

Enjoy.  
-r

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [August 17, 2009, 8:59pm UTC](https://www.ruby-forum.com/t/release-a-which-command-written-in-ruby-very-useful-for-windows-users-at-least/173887/2 "2009-08-17T20:59:05Z")

</div>

On Aug 17, 2009, at 10:10, Roger P. wrote:

> Also Related: [GitHub - Pistos/ruby-which: Like the UNIX "which" tool, but for Ruby libraries.](http://github.com/Pistos/ruby-which) – this library  
> discovers the location of installed ruby libraries, i.e. which gem  
> folder they’re in  
> “C:\>rwhich ruby-which  
> c:/ruby/lib/ruby/gems/1.9.1/gems/Pistos-ruby-which-0.5.3/lib/ruby-  
> which.rb”

$ gem which fileutils  
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/  
1.8/fileutils.rb  
$ gem which nokogiri  
(checking gem nokogiri-1.3.2 for nokogiri)  
/Library/Ruby/Gems/1.8/gems/nokogiri-1.3.2/lib/nokogiri.rb

# incidentally, it’s TTY smart:

$ gem which nokogiri | cat  
/Library/Ruby/Gems/1.8/gems/nokogiri-1.3.2/lib/nokogiri.rb

---

<div class="post-metadata">

**Author:** ![rogerdpack](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/45deac/32.png) [@rogerdpack](https://www.ruby-forum.com/u/rogerdpack)\
**Post date:** [August 18, 2009, 5:54pm UTC](https://www.ruby-forum.com/t/release-a-which-command-written-in-ruby-very-useful-for-windows-users-at-least/173887/3 "2009-08-18T17:54:12Z")

</div>

> $ gem which fileutils  
> /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/fileutils.rb

Nice. I’ve noted the usefulness of “gem which” in the README file now.

Also have updated whichr to v 0.1.2 now to incorporate a few of Alexey  
Borzenkov’s suggestions.

ChangeLog:  
respect’s ENV[‘PATHEXT’] now on windows

-r
