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).

Re: Subst.exe internal table by Jan

Jan
Fri Sep 07 14:32:59 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).
SUBST without params displays list of substituted drives. Use something
like SUBST > listdrives.txt
and parse the file listdrives.txt

Re: Subst.exe internal table by Lew

Lew
Sat Sep 08 06:51:16 PDT 2007

I'm really hoping to find an api call that does it. The dos redirect may not
finish creating the file before the next line of foxcode fires. I know some
workarounds for this problem, but I am hoping to avoid them.

"Jan Bucek" <bucek.jan@post.cz> wrote in message
news:OTn0maZ8HHA.1416@TK2MSFTNGP03.phx.gbl...
> 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).
> SUBST without params displays list of substituted drives. Use something
> like SUBST > listdrives.txt
> and parse the file listdrives.txt



Re: Subst.exe internal table by Aaron

Aaron
Mon Sep 10 00:19:38 PDT 2007


"Jan Bucek" <bucek.jan@post.cz> skrev i meddelandet
news:OTn0maZ8HHA.1416@TK2MSFTNGP03.phx.gbl...
> 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).
> SUBST without params displays list of substituted drives. Use something
> like SUBST > listdrives.txt
> and parse the file listdrives.txt

You could do it using run:
run subst.exe >temp.txt
Then open temp.txt using fopen() and analyze it using fgets() + string
functions.


Re: Subst.exe internal table by Lew

Lew
Mon Sep 10 03:44:49 PDT 2007

Isn't this what Jan just wrote?
"Aaron" <aaron@nospam.co.uk> wrote in message
news:ee6Fi.8335$ZA.4363@newsb.telia.net...
>
> "Jan Bucek" <bucek.jan@post.cz> skrev i meddelandet
> news:OTn0maZ8HHA.1416@TK2MSFTNGP03.phx.gbl...
>> 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).
>> SUBST without params displays list of substituted drives. Use something
>> like SUBST > listdrives.txt
>> and parse the file listdrives.txt
>
> You could do it using run:
> run subst.exe >temp.txt
> Then open temp.txt using fopen() and analyze it using fgets() + string
> functions.
>



Re: Subst.exe internal table by Jan

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
--------------