I am only assuming that you are doing this for drive mapping?.....

why not use the * for next available drive letter?

use * "\\server\share\"

Here is a bit of code that reports what network drives are in use, it uses output from the "net use" command. Also note that the way it builds $report by using separate $drive and $share variables.

code:

$cr = chr(13) + chr(10)
$report = ""
shell '%comspec% /c net use | find /i ":" > temp.dat'
$q = open(1,"temp.dat",2)
$line = readline(1)
do
$drive = substr("$line",14,2)
$share = substr("$line",24,26)
$report = $report + "$drive = $share$cr"
$line = readline(1)
until @error <> 0
$q = close(1) del "temp.dat"

? $report
$q = messagebox("$report","Drives in use",64)


Bryce

[This message has been edited by Bryce (edited 16 August 2000).]