@ECHO OFF ;;The last drive before a non-existent drive whose ;;Volume Label is VDISK or MS-RAMDRIVE, is RAMDRIVE. ;;If ENV-var XMASS has been set (in config.sys), ;;USB/1394 mass-storage(s) might take the last letter ;;after RAMDISK thus only the Label rule is reliable. ;;In 2nd round, this detects the last USB/1394 drive. IF NOT "%XMASS%"=="" AND "%LABEL%"=="" GOTO WMASS IF NOT "%LABEL%"=="" SET ROUND=2 :LOOP IF NOT EXIST %1:\NUL GOTO SOLVED SET BUFF=%1 SHIFT IF NOT "%1"=="" GOTO LOOP GOTO END :SOLVED IF "%BUFF%"=="" GOTO END ASET LABEL=LABEL('%BUFF%') SET LABEL=_%LABEL% IF "%LABEL%"=="_VDISK" OR "%LABEL%"=="_MS-RAMDRIVE" GOTO FOUND IF "%ROUND%"=="2" SET ASPIMASS=%BUFF% GOTO END :WMASS ASET LABEL=LABEL('%1') SET LABEL=_%LABEL% IF "%LABEL%"=="_VDISK" OR "%LABEL%"=="_MS-RAMDRIVE" SET RAMD=%1 SHIFT IF NOT "%1"=="" GOTO WMASS detecdrv %LGLDRV% :FOUND SET RAMD=%BUFF% :END SET LGLDRV= SET BUFF= SET LABEL= SET ROUND=