From: Siep Korteling Date: 2008-09-20T07:11:13+09:00 Subject: Re: How to read drive label Thomas B. wrote: > Hello. I'd like to get the labels of the hard drives (partitions) on my > machine from within a program. Is there any universal Ruby command to do > it? > > I'm on Windows, so I guess I could use some WinAPI to do that but I'd > prefer not to, if it is possible. But any solution will be appreciated! > > TPR. For windows: require 'ruby-wmi' disks = WMI::Win32_LogicalDisk.find(:all, :conditions=>{:drivetype=>3}) disks.each do |disk| puts "#{disk.deviceid} #{disk.volumename}" end # There is a lot more info in "disks" puts "_______________________" disks.each do |disk| disk.properties_.each do |p| puts "#{p.name}: #{disk[p.name]}" unless (disk[p.name]).nil? end end hth, Siep -- Posted via http://www.ruby-forum.com/.