in reply to how to identify the windows drives
use Win32::OLE qw( in ); my $wmi_service = Win32::OLE->GetObject("winmgmts:{impersonationLevel= +impersonate}!\\\\.\\root\\cimv2") or die("Unable to connect to WMI: $!\n"); # DriveType 3 = local hard disk my $disk_col = $wmi_service->ExecQuery(" SELECT DeviceID FROM Win32_LogicalDisk WHERE DriveType = 3 "); my @drives = map { $_->DeviceID } in $disk_col; local $, = ", "; local $\ = "\n"; print @drives;
On my computer, the above prints C:, D:, E:.
If I remove the WHERE clause, it prints A:, B:, C:, D:, E:, F:, G:, H: (Floppy drives, hard drives, optical drives, USB drives, network drives, virtual drives, etc.)
|
|---|