本帖最后由 aloha20200628 于 2024-10-19 23:12 编辑
回复 23# 青青草
方法一》计入光驱- @echo off
- for /f "tokens=1* delims=: " %%1 in (' fsutil.exe fsinfo drives^|find ":" ') do set "dl=%%2"
- set "dl=%dl::\=%"
- echo,%dl%
- pause&exit/b
复制代码 方法二》不计入光驱- @echo off &setlocal enabledelayedexpansion &set "dl="
- 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: set "dl=!dl!%%d "
- echo,!dl!
- endlocal&pause&exit/b
复制代码
|