DECLARE INTEGER WNetCancelConnection IN Win32API STRING, INTEGER IF WNetCancelConnection(cDriveLetter, 1) != 0 && 1: disconnect by force even if any file open nDType = 3 && if fail to disconnect because the folder was *Substed* ENDIF IF nDType = 3 && local hard disks, including *Substed* drives cMapCmd = "subst /d " + cDriveLetter + " > nul" RUN &cMapCmd ENDIF IF cDriveType = "NET" cMapCmd = "net use " + cDriveLetter + " " + cDrivePath + " > nul" ELSE && regarded as "Local", do a subst instead cMapCmd = "subst " + cDriveLetter + " " + cDrivePath + " > nul" ENDIF RUN &cMapCmdCheers!