Win32 Drive List Redux

Tim Daneliuk tundra at
Fri Jan 3 02:50:07 CET 2003

Tim Daneliuk wrote:
> Some time ago, there was a brief thread on how to get a list of
> available drives on Win32.  Peter Hansen suggested the use of:

Well, here is a "Sort-Of" solution. It suffers from the fact that it is
not in sync with reality of the machine - it reports B: on my system
(which has none) and incorrectly shows a network drive that has been
detatched.  Still, its kind of interesting...

from _winreg import *

reg  = ConnectRegistry(None,HKEY_CURRENT_USER)
k = OpenKey(reg, r"Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints")

drivelist = []
for i in range(QueryInfoKey(k)[0]):
     drivelist.append(EnumKey(k,i) + ":\\")

print drivelist

Tim Daneliuk
tundra at

More information about the Python-list mailing list