views:

314

answers:

3

I am using Daemon tool to mount an ISO image on Windows XP machine.I do mount using Daemon command (daemon.exe -mount 0,iso_path).

Above command will mount ISO image to device number. In my case I have 4 partition (C,D,E,F) and G for DVD/CD-RW. Now what happen, ISO gets mounted to drive letter 'H:' with name (as defined while creating ISO) say 'testmount'.

My queries:-

1) How can I get mount name of mounted ISO image (i.e. 'testmount'). Just another case; if there are already some mount points existing on machine and I created a new one using Daemon tool. Then If I can get latest one using script that will be great.

2) How to get drive letter where it did get mounted.

If anyone know python script or command (or even Win command ) to get these info. do let me know.

Thanks...

A: 

The daemon tools exe itself has some command line parameters :

-get_count and -get_letter

But for me these do not work in the latest version (DLite).

Instead you can use the commands :

mountvol - lists all the mounted drives

dir - you can parse the output to get the volume label

What you should do is run mountvol before daemon, and after, so you can detect the new drive letter. After that use "dir" to get the volume label.

I believe you can run these commands using the os.system() call in python

rep_movsd
@rep_movsd thanks for reply and now I can get volume name and drive,btw I checked that 'mountvol - lists' lists same volume list (some GUID and drive letter) before mounting a new ISO using Daemon tool and after mounting it. Means there is no change. Not sure why this happened.Thanx again...
aberry
@rep_movsd ... got 1 problem on 1 of the machine. due to same result through 'mountvol - lists', I tested on 2-3 machine and found that 'Last entry' of volume list is the mounted by Daemon tool.but on one of the machine I found 'A:\' is returned so I got error, as I thought that my data mounted at returned drive.Any other way to get mounted drive on windows ?thnx
aberry
A: 

You can list drives using wmi console:

C:\>wmic logicaldisk get Name, DriveType

The numeric values of the drive types will let you distinguish between different types.

The WMI is available is python module as well, though this needs to be installed separately.

newtover
A: 

adding newtover, getting list of drives from wmi console output

[i.strip() for i in os.popen('wmic logicaldisk get Name').readlines() if i.strip()<>''][1:]

pebbie