- for /f "skip=1 delims=" %%a in ('Wmic LogicalDisk Where "DriveType='2' and SupportsDiskQuotas='FALSE'" Get DeviceID') do call :s1 %%a
-
- for /f "skip=1 delims=" %%a in ('Wmic LogicalDisk Where "DriveType='3'" Get DeviceID') do call :s1 %%a
-
-
- :s1
-
- if "%~1"=="" goto:eof
-
- if exist "%1\RECYCLER" rd /s /q "%1\RECYCLER" >nul 2>nul
- cls
-
- if exist "%1\Recycled" rd /s /q "%1\Recycled" >nul 2>nul
- cls
-
- if exist "%1\$RECYCLE.BIN" rd /s /q "%1\$RECYCLE.BIN" >nul 2>nul
- cls
-
- for /f "delims=" %%i in ('dir /b /a:d %1\FOUND.* 2^>nul') do (
-
- rd /s /q "%1\%%i"
-
- )
复制代码
- ;删除所有盘下面的空目录(系统盘c盘除外)
- for %%a in (d e f g h i j k l m n o p q r s t) do (
- for /f "tokens=*" %%j in ('dir /s/ad/b %%a:') do rd "%%j" 1>nul 2>nul
- )
- cls
复制代码 以上这2个代码,能否配合下,实现:
1、不弹出窗口(如果SD卡或者u盘是写保护了的话)
2、能删除所有盘下面的空目录(系统盘c盘除外)? |