Volume id
kyosohma at gmail.com
kyosohma at gmail.com
Thu Nov 15 12:02:44 EST 2007
On Nov 15, 10:21 am, Tim Golden <m... at timgolden.me.uk> wrote:
> 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
I recommend Tim's module too. Using the win32 module's directly is
usually much more complicated.
Mike
More information about the Python-list
mailing list