本帖最后由 Nsqs 于 2016-4-24 17:25 编辑
关于0kb删除- @echo off&setlocal enabledelayedexpansion
- :return
- set/a n=-1,p=-1,cc=0
- for /f "delims=" %%1 in ('dir/s/b/a-d')do (
- if %%~z1 equ 0 (
- set/a p+=1
- set f!p!=%%1
- set s!p!=%%~nx1
- if !n! lss 9 set /a n+=1&call echo [!n!]%%~nx1
- ))
- set c=-1
- :select
- echo 输入u表示上一页;l表示下一页;
- set /p input=输入要删除的编号(A表示全部删除;[0-9]表示删除第n项;s表示删除10个):
- if /i "%input%"=="s" call:_N
- if /i "%input%"=="a" call:_all
- if /i "%input%"=="u" set/a cc-=1, c=cc*10&call:_U
- if /i "%input%"=="l" set/a cc+=1, c=cc*10&call:_L
- if /i "%input%"=="q" exit
- echo %input%|findstr "[0-9]" >nul 2>nul
- if %errorlevel%==0 set /a c=cc*10,ss=-1&call:_del
- goto select
-
- :_all
- cls&(for /l %%1 in (0 1 %p%)do set "s%%1="&del !f%%1!&set "f%%1=")2>nul&goto :eof
- :_U
- cls&if %c% lss 0 set/a c=0,cc=0
- for /l %%1 in (0 1 9)do (set/a z=c+%%1
- call set x$=%%s!z!%%
- if not !x$!#==# echo [%%1]!x$!)
- goto :eof
- :_L
- cls&if %c% gtr %p% set/a c=c-10,cc-=1
- for /l %%1 in (0 1 9)do (
- set/a z=c+%%1
- call set x$=%%s!z!%%
- if not !x$!#==# echo [%%1]!x$!
- )
- goto :eof
-
- :_del
- cls&set/a ss+=1,r=0&set x$=!input:~%ss%,1!
- if not !x$!#==# (
- set/a r=c+!x$!
- call del %%f!r!%%
- goto _del
- )
- call:return
- goto :eof
- :_N
- cls&for /l %%1 in (0 1 10)do (
- set/a z=c+%%1
- call set x$=%%f!z!%%
- if not !x$!#==# del !x$!
- )
- call:return
- goto :eof
复制代码
|