FUNCTION FindDrive LPARAMETER tcUNC && The UNC to find LOCAL lnlast, lni, loNet, loDrives, lcresult, llfound lcresult = "" llfound = .F. loNet = CREATEOBJECT("WScript.Network") loDrives = loNet.EnumNetworkDrives lnlast = loDrives.Count lni = -1 DO WHILE lni < lnlast AND NOT llfound lni = lni + 2 llfound = (UPPER(tcUNC) = UPPER(oDrives.Item(lni))) ENDDO IF llfound lcresult = oDrive.Item(lni - 1) ENDIF RETURN lcresultNote that the offset is zero based rather than one based. For example, if the Count property returns 2, the indexes are 0 and 1.