kzar Posted June 29, 2007 Posted June 29, 2007 Does anyone know how to get the Drive and Partition numbers of 'Drives' like C:? I need to figure out if C: is the first partition on the drive its on or not. Thanks, Kzar
Joon Posted June 29, 2007 Posted June 29, 2007 Partitions are start from count 0. $objWMIService = ObjGet("winmgmts:\\.\root\CIMV2") $WMIQuery = $objWMIService.ExecQuery ("SELECT * FROM Win32_LogicalDiskToPartition") For $obj In $WMIQuery If StringInStr($obj.Dependent,"C:") Then MsgBox(0,"C Drive","C Drive is on partition #" & StringMid($obj.Antecedent,StringLen($obj.Antecedent)-1,1)) EndIf Next
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now