*.rb not running on Windows any more

P

Phrogz

At work, I installed 1.8.2 from the one-click.
I wrote a handy utility named "findfile.rb", and put it in my
windows\system32 directory.
I was happy, because I could open any cmd window and type "findfile
...." and my ruby script would kick the crap out of Windows' built-in
search features.

But then I installed 1.8.4 from the one-click.
Now, when I type "findfile ..." in a command window, Windows rudely
informs me:
"'findfile' is not recognized as an internal or external command,
operable program or batch file."

The findfile.rb file is still in the same spot.
Ruby was installed in the same spot.
I've tried associating *.rb with c:\ruby\bin\ruby.exe and
c:\ruby\bin\rubyw.exe, but to no avail.

Who can help me in my quest to continue to kick the crap out of
Windows' built-in search?

(For those interested, following is my hack script. It was originally
written to allow regexp filename searching, and was later expanded to
allow regexp content searching, too.)

require 'rubygems'
require_gem 'Usage'
usage = Usage.new "name_regexp [content_regexp]"

class Dir
def self.crawl( path, max_depth=nil, depth=0, &block )
return if max_depth && depth > max_depth
begin
if File.directory?( path )
files = Dir.entries( path ).select{ |f| f[0,1]!='.' }
unless files.empty?
files.collect!{ |file_path|
Dir.crawl( path+'/'+file_path, max_depth, depth+1, &block )
}.flatten!
end
return files
elsif File.file?( path )
yield( path, depth )
end
rescue SystemCallError => the_error
warn "ERROR: #{the_error}"
end
end

end

start_time = Time.new
name_match = Regexp.new( usage.name_regexp, true )
content_match = usage.content_regexp && Regexp.new(
".{0,10}#{usage.content_regexp}.+", true )

matching_count = 0
Dir.crawl( '.', usage.max_depth ){ |file_path, depth|
if File.split( file_path )[ 1 ] =~ name_match
if content_match
if IO.read( file_path ) =~ content_match
puts file_path," #{$~}"," "
matching_count += 1
end
else
puts file_path
matching_count += 1
end
end
}
end_time = Time.new
puts "(Found #{matching_count} files in #{end_time-start_time} seconds)"
 
B

Ben Zealley

But then I installed 1.8.4 from the one-click.
Now, when I type "findfile ..." in a command window, Windows rudely
informs me:
"'findfile' is not recognized as an internal or external command,
operable program or batch file."

The findfile.rb file is still in the same spot.
Ruby was installed in the same spot.
I've tried associating *.rb with c:\ruby\bin\ruby.exe and
c:\ruby\bin\rubyw.exe, but to no avail.

Who can help me in my quest to continue to kick the crap out of
Windows' built-in search?

I'm guessing a bit here, but the problem might lie in the Path or
PATHEXT environment variables, rather than Explorer's file associations
(which I don't think cmd even knows about) - one or the other may have
been modified by the 1.8.4 one-click? I'm probably embarrassingly wrong
though, so hopefully someone else can be more helpful...
 
P

Phrogz

Ben said:
I'm guessing a bit here, but the problem might lie in the Path or
PATHEXT environment variables

PATHEXT it was, thanks!

Now I can go back to pwning Microsoft and usage this computer in a
moderately more reasonable fastion.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top