#!/usr/bin/perl -w use strict; use Win32API::File qw( getLogicalDrives GetVolumeInformation ); for my $root ( @ARGV ? @ARGV : getLogicalDrives() ) { my( $vol, $ser, $maxlen, $bits, $fs ); $root .= ":" if length($root) < 2; $root .= "/" if length($root) < 3; if( ! GetVolumeInformation( $root, $vol, [], $ser, $maxlen, $bits, $fs, [] ) ) { warn "Can't get information about $root: $^E\n"; } else { print "$root is $fs named ($vol)\n"; } } #### #!/usr/bin/perl -w use strict; use Win32API::File qw( GetVolumeInformation ); sub getVolumeLabel { my( $root )= @_; $root .= ":" if length($root) < 2; $root .= "/" if length($root) < 3; my $vol; GetVolumeInformation( $root, $vol, [], [], [], [], [], [] ) or undef $vol; return $vol; } for my $root ( @ARGV ) { my $label= getVolumeLabel($root); if( defined $label ) { print "$root is ($label).\n"; } else { warn "Can't get label for $root: $^E\n"; } }