This nice loop checks if a drive is free in the string $LETTERS and returns the var $FREELETTER

But if you set $LETTERS to "XYZ" and X is a CD without a CD-Rom the "if exist..." returns that it's free.

Any ideas of workaround?

:CHKDRIVES
$i = 1
while $i < len($LETTERS)+1
$tkn=substr($LETTERS, $i, 1)
if exist($TKN + ":\nul")
else
$FREELETTER = $TKN
return
endif
$i=$i+1
loop
return


The use of it is in a script that mounts a free letter to a network-share, and if X is a CD you will get a error 85.

------------------
--
rikard.ronnkvist@martinsson.se