Volume id

Tim Golden mail at timgolden.me.uk
Thu Nov 15 11:21:17 EST 2007


Gabor Urban wrote:
> OK, you are right... Problem was not precise enough. I need to process CDs
> to create a list. Does it ring a bell for you?

On Windows, at least, you can do this with WMI:

<code>
import win32com.client

wmi = win32com.client.GetObject ("winmgmts:")
for result in wmi.ExecQuery (
   """SELECT VolumeSerialNumber
   FROM Win32_LogicalDisk
   WHERE DriveType=5"""
):
   print result.Properties_ ("VolumeSerialNumber")

</code>

If you do anything non-trivial with WMI, I <cough> recommend
my WMI module:

http://timgolden.me.uk/python/wmi.html

TJG



More information about the Python-list mailing list