本帖最后由 batman 于 2013-1-19 20:56 编辑
运行下面代码当显示正确时将倒数第二行的echo 去掉再运行就能删除要删除的文件夹了:- @echo off&setlocal enabledelayedexpansion
- for %%a 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 %%a:\nul (
- for /f "delims=" %%b in ('dir /ad /b /s %%a:\users 2^>nul') do (
- set "str=%%b"
- if "!str:qq\users=!" neq "!str!" (
- for /f "delims=" %%b in ('dir /ad /b "!str!"') do (
- if /i "%%b" neq "all users" (
- set /a n+=1
- set "_!n!=%%b"&set ".!n!=!str!"
- )
- )
- )
- )
- )
- )
- :lp
- cls&set "select="
- for /l %%a in (1,1,%n%) do echo %%a: !_%%a!
- set /p select=请输入要删除的文件夹序号:
- if not defined select goto lp
- if %select% geq 1 if %select% leq %n% goto next
- goto lp
- :next
- echo rd /s /q "!.%select%!\!_%select%!"
- pause>nul
复制代码
|