1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
@echo off
setlocal enabledelayedexpansion
set drive=
echo:
:__1
for /f "usebackq tokens=1* delims=:" %%a in (`fsutil fsinfo drives ^| find ":"`) do (
set L_Drives=%%a &goto :__L_Drives
)
:__L_Drives
echo/[%L_Drives%]
:# trim space from the end of string
IF "%L_Drives:~-1%"==" " SET L_Drives=%L_Drives:~0,-1%
echo/:__L_Drives [%L_Drives%]
:__21
for /f "usebackq tokens=1* delims=:" %%a in (`vol %systemdrive% ^| findstr "%systemdrive:~0,-1%"`) do (
set L_strg=%%a
)
:__S_strg1
call :__L_strg
set "S_strg1=%L_strg%"
call :__subst
:__22
for /f "usebackq skip=1 tokens=1* delims=:" %%a in (`vol %systemdrive%`) do (
set L_strg=%%a
)
:__S_strg2
call :__L_strg
set "S_strg2=%L_strg%"
:__4
for /f "usebackq tokens=1*" %%a in (`fsutil fsinfo drives ^| find ":"`) do (
if /i "%%a" NEQ "%L_Drives%:" (
set "drive=%%a"
) ELSE (
set "drive=%%b"
)
set drive=!drive:\=!
for %%D in (!drive!) do (
set label=
for /f "usebackq tokens=1* delims=\- " %%A in (`fsutil fsinfo drivetype %%D`) do (
for /f "usebackq tokens=5*" %%U in (`vol %%A 2^>nul ^| findstr "^.%S_strg1%" ^| findstr /v "^.%S_strg2%"`) do set label=%%V
set type=%%B
)
set "label=!label! "
set type=!type:~0,-1!
for /f "usebackq tokens=2*" %%R in (`subst 2^>nul ^| findstr /i /b "%%D"`) do set type=SUBST : %%S
echo:%%D [!label:~0,32!] !type!
)
)
echo:
goto :eof
:__L_strg
:# trim space from the beginning of string
echo/:__L_strg [%L_strg%]
for /f "tokens=* delims= " %%a in ("%L_strg%") do set L_strg=%%a
echo/:__L_strg [%L_strg%]
:# subst space with dot
SET L_strg=%L_strg: =.% &call :__loop .
:# trim dot from the end of string
call :__trimlast .
goto :eof
:__loop
:# trim right from the end until char equ dot
IF "%L_strg:~-1%" NEQ "%1" SET "L_strg=%L_strg:~0,-1%" &goto :__loop
goto :eof
:__trimlast
:# trim %1 from the end of string
IF "%L_strg:~-1%"=="%1" SET L_strg=%L_strg:~0,-1%
echo/:__trimlast [%L_strg%]
goto :eof
:__subst
set L_strg=%systemdrive%
:# trim : from the end of string
call :__trimlast :
set "S_strg3=%L_strg%"
call set S_strg1=%%S_strg1:.%S_strg3%.=...%%
echo/:__subst [%S_strg1%]
goto :eof |
Partager