[YC]使用cmd脚本获得系统驱动器列表[SH]
只使用标准的cmd命令完成,运行后环境变量LglDrv中保存的就是系统的所有驱动器盘符
-----------------------------------------------------------
rem @echo off
rem DriveWalkerInBatch by silentmj@126.com
if not defined IsLglDrvGot set IsLglDrvGot=0
if %IsLglDrvGot%==0 set LglDrv=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
if %IsLglDrvGot%==0 set Temp=
if %IsLglDrvGot%==1 goto _lgldrv_got
if %IsLglDrvGot%==0 set IsLglDrvGot=1&&%0 %LglDrv%
:_lgldrv_got
:_loop
@dir %1:/>NUL 2>NUL
if %errorlevel%==0 set Temp=%temp% %1
shift
if not %1""=="" goto _loop else goto _ext
:_ext
set IsLglDrvGot=
set LglDrv=%temp%
set Temp=
-----------------------------------------------------------
rem @echo off
rem DriveWalkerInBatch by silentmj@126.com
if not defined IsLglDrvGot set IsLglDrvGot=0
if %IsLglDrvGot%==0 set LglDrv=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
if %IsLglDrvGot%==0 set Temp=
if %IsLglDrvGot%==1 goto _lgldrv_got
if %IsLglDrvGot%==0 set IsLglDrvGot=1&&%0 %LglDrv%
:_lgldrv_got
:_loop
@dir %1:/>NUL 2>NUL
if %errorlevel%==0 set Temp=%temp% %1
shift
if not %1""=="" goto _loop else goto _ext
:_ext
set IsLglDrvGot=
set LglDrv=%temp%
set Temp=