[EMAIL PROTECTED] > i want to check the position of a volume in a particular > drive. say for example in a disk i have 3 different drives: > C:\ , D:\ and E:\. > Now if i want to check what position is the D:\ in, how > can i write the code. Means whether its in a 0th position > or 1st position or a 2nd position. > Is there any way using win32api or win32com.
> if i want to check a particular volume is a logical, or a primary one , > what is the method i have to use? does it can also be done through > win32api. Well, this page suggests that it's possible using WMI: http://www.microsoft.com/technet/scriptcenter/resources/qanda/may05/hey0 523.mspx and, using the WMI module from here: http://timgolden.me.uk/python/wmi.html this bit of code seems to give you what you want. <code> import wmi c = wmi.WMI () for physical_disk in c.Win32_DiskDrive (): for partition in physical_disk.associators ("Win32_DiskDriveToDiskPartition"): for logical_disk in partition.associators ("Win32_LogicalDiskToPartition"): print physical_disk.Caption, partition.Caption, logical_disk.Caption </code> Obviously, I've just printed the Caption, but you could pick up whatever information you wanted from the disk, partition & logical_disk objects. If you just print the object itself, it will give you all its fields and values. By the way, thanks for the question. I've never come across a meaningful example of WMI associators before, although I've had the code in the module since the first version. TJG ________________________________________________________________________ This e-mail has been scanned for all viruses by Star. The service is powered by MessageLabs. For more information on a proactive anti-virus service working around the clock, around the globe, visit: http://www.star.net.uk ________________________________________________________________________ -- http://mail.python.org/mailman/listinfo/python-list