Login Register


[Source] Get list of drives in Windows filter_list
Author
Message
[Source] Get list of drives in Windows #1
The thread title is self-explanatory and so is the code. Nothing much to explain.

Code:
import string from ctypes import windll def get_drives(): drive_list = [] bitmask = windll.kernel32.GetLogicalDrives() for letter in iter(string.letters[len(string.letters)/2:]): if bitmask & 1: drive_list.append(letter) bitmask >>= 1 return drive_list if __name__ == '__main__': print(get_drives())
[Image: OilyCostlyEwe.gif]

[+] 1 user Likes Psycho_Coder's post
Reply







Users browsing this thread: 1 Guest(s)