Jan
Mon Sep 10 15:28:58 PDT 2007
Lew napsal(a):
> Is there a way to retrieve the drive letters & associated devices created by
> subst.exe? (Would need to distinguish bet these and those created via net use
> calls).
Only some ideas:
- you can enumerate all drives with FileSystemObject
- you can enumerate network drives only with WScript.Network
- drives created by subst have the same SN, VolumeName and TotalSize
like "parent" drive (C: mostly)
See more there:
http://msdn2.microsoft.com/en-us/library/95dtkhsz.aspx
and there:
http://msdn2.microsoft.com/en-us/library/907chf30.aspx
Small test prg:
--------------
clear
* enumerate all drives
objFSO = CreateObject("Scripting.FileSystemObject")
colDrives = objFSO.Drives
For Each objDrive in colDrives
?"Drive letter: ", objDrive.DriveLetter, " Share name: ",
objDrive.ShareName, "Drive type: ", objDrive.DriveType
IF objDrive.IsReady
?" Volume Name: ", objDrive.VolumeName, " SN: ", objDrive.SerialNumber
ENDIF
?
Next
wait
* enumerate network drives only
LOCAL WshNetWork AS OBJECT
LOCAL oDrives AS OBJECT
WshNetWork=CREATEOBJECT("WScript.Network")
oDrives=WshNetWork.EnumNetworkDrives &&NOTE: This array is 0 based
FOR i=0 TO oDrives.COUNT-1 STEP 2
? oDrives.ITEM[i], oDrives.ITEM[i+1] && drive letter, volume name
ENDFOR
wait
RETURN
--------------