:: 获取纯DOS方式的最后盘符
setlocal EnableDelayedExpansion
set drives= CDEFGHIJKLMNOPQRSTUVWXYZ
for /f %%i in ('wmic logicaldisk where "drivetype=3" get FileSystem ^| find /c "FAT"') do set doslastdrive=!drives:~%%i,1!:
@echo off
setlocal enabledelayedexpansion
set bb=
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
set aa=
for /f "tokens=*" %%a in ('dir %%i:\#### 2^>^&1^|findstr /I "specified 指"') do set aa=%%a
if not "!aa!"=="" (
echo !bb!:
goto :eof
)
set bb=%%i
)
Originally posted by wangff at 2008-11-26 11:16 AM:
@echo off
setlocal enabledelayedexpansion
set bb=
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
set aa=
for /f "tokens=*" %%a in ('dir %%i:\#### 2^> ...
@echo off
setlocal EnableDelayedExpansion
set drives= CDEFGHIJKLMNOPQRSTUVWXYZ
for /f %%i in ('wmic logicaldisk where "drivetype=3" get FileSystem ^| find /c "FAT"') do set doslastdrive=!drives:~%%i,1!:
echo DOS 下最后分区盘符是 %doslastdrive%。
for /f %%a in ('"wmic logicaldisk where DriveType="3" get DeviceID |find /v "DeviceID""') do set cmdlastdrive=%%a
echo CMD 下最后分区盘符是 %cmdlastdrive%。
pause
@echo off
setlocal EnableDelayedExpansion
set drives= CDEFGHIJKLMNOPQRSTUVWXYZ
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
for /f "tokens=2" %%a in ('chkntfs %%i:^|findstr /i "FAT32"') do (
if "%%a"=="FAT32。" set num+=1
)
)
set doslastdrive=!drives:~%num%,1!:
echo %doslastdrive%
pause
@echo off
setlocal EnableDelayedExpansion
set drives= CDEFGHIJKLMNOPQRSTUVWXYZ
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
set aa=
for /f "tokens=*" %%a in ('chkntfs %%i:^|findstr /i "FAT32"') do (
if not "%%a"=="" set/a num+=1
)
)
set doslastdrive=!drives:~%num%,1!:
echo %doslastdrive%
pause
@echo off
setlocal EnableDelayedExpansion
set drives= CDEFGHIJKLMNOPQRSTUVWXYZ
for %%i in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
for /f "tokens=2" %%a in ('chkntfs %%i:^|findstr /i "文件系统的类型是"') do (
if "%%a"=="RAW。" goto :end
if "%%a"=="FAT32。" set /a num+=1
)
)
:end
set doslastdrive=!drives:~%num%,1!:
echo %doslastdrive%
pause
期待更好的批处理。
[ Last edited by chishingchan on 2008-11-26 at 15:14 ]