本帖最后由 tmplinshi 于 2022-12-8 00:15 编辑
- @echo off
-
- set "DrvU="
-
- for %%d 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 (
- if exist %%d: (
- for /f "tokens=1-3,*" %%1 in (' vol %%d: ') do (
- if "%%1" == "驱动器" (
- if "%%4" == "D^F" set "DrvU=%%d" & goto :Next
- )
- )
- )
- )
-
- :Next
- if defined DrvU (
- echo %DrvU%
- ) else (
- echo 未找到相应卷标
- )
-
- pause
复制代码
|