From: Jano Svitok Date: 2007-07-03T23:36:29+09:00 Subject: Re: mac addr determination On 7/3/07, ara.t.howard wrote: > > can someone run this on windows and let me know if it works? > > def mac_address > return @mac_address if defined? @mac_address > re = %r/[^:\-](?:[0-9A-Za-z][0-9A-Za-z][:\-]){5}[0-9A-Za-z] > [0-9A-Za-z][^:\-]/o > lines = > begin > IO.popen('ifconfig'){|fd| fd.readlines} > rescue > IO.popen('ipconfig /all'){|fd| fd.readlines} > end > candidates = lines.select{|line| line =~ re} > @mac_address = candidates.first[re].strip > end > > > thanks! works. J.