Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re^2: Finding mapped drive data

by merrymonk (Hermit)
on May 06, 2011 at 06:44 UTC ( [id://903332]=note: print w/replies, xml ) Need Help??


in reply to Re: Finding mapped drive data
in thread Finding mapped drive data

Thanks for that. I did try the Perl in the link but sadly I did not have the required Win32::DriveInfo.
However I did use your google search and found a page which explained where the drive letters are in the registry.
The following Perl gives what I wanted.
It works for XP but I do not know about other Windows OS
use strict "vars"; my (%dletters, $return_code, $return_message, $jl); sub drive_letters_find($$$) { ##------------------------------------------------------------------- ## this gets the drive letters and their paths for the current PC # it returns a has where key is drive letter - value is it contents ## ------------------------------------------------------------------ my ($ref_dletters, $ref_return_code, $ref_return_message) = @_; my ($pp, $k, $key, $vals, $CurrVer, %vals); use Win32::Registry; $pp = "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Map Net +work Drive MRU\\"; $$ref_return_code = $main::HKEY_CURRENT_USER->Open($pp, $CurrVer); if($$ref_return_code == 1) { $$ref_return_message = 'drive letters found'; $CurrVer->GetValues(\%vals); foreach $k (keys %vals) { $key = $vals{$k}; $ref_dletters->{$$key[0]} = $$key[2]; } } else { $$ref_return_message = "Could not open regsitry $pp\n\n"; } } drive_letters_find(\%dletters, \$return_code, \$return_message); print "\nafter drive_letters_find\nresult code <$return_code> message +<$return_message>\n"; if($return_code == 1) { print "mapped drive letters found\n"; foreach $jl (sort {$a cmp $b} keys %dletters) { print "letter <$jl> path <$dletters{$jl}>\n"; } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://903332]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (6)
As of 2024-04-23 21:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found