Search code examples
windowsperlmount

How can I specify the name of a mounted drive in Windows when mounting programmatically?


I am writing a perl routine that mounts specific drives at startup. However, when the drives are mounted, they appear in "My Computer" with odd names like "dir$ at 'machinename' (H:)".

Is there a way in perl or C to specify this string (or just the 'dir$' part?) at mount-time?


Solution

  • After much searching, one way to do it is by monkeying with the registry--not a great method, but it works

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\DriveIcons\D\DefaultLabel]
    

    will set the visible label for the D: drive, etc.