参考使用下面代码: @echo off if "%1" == "h" goto begin mshta vbscript:createobject("wscript.shell").run("%~fs0 h",0)(window.close)&&exit :begin setlocal enabledelayedexpansion set n= set p=D:\My Documents\My Pictures pushd %p% for /f "tokens=*" %%i in ('dir/b/od *.jpg') do ( set /a n+=1 if !n! leq 4 del "%%i" )
求采纳