这段代码在g:\test下有bak就不会出错但是一旦没有bak就会闪退请问一下这个问题出在了哪里- setlocal enabledelayedexpansion
- :again
- set /p "cho=y/n?"
- set w=&set "ds=0"
- pushd g:\test
- if "%cho%"=="y" (for /f "delims=" %%i in ('dir /b/s *.bak 2^>nul') do (set /a "w=!w!+1"&del /q/f "%%i"&set /a "ds=!ds!+%%~zi")&echo 删除了!w!个文件,一共为!ds!KB&pause>nul&popd&goto:main) else (if "%cho%"=="n" (popd&goto:main))
- goto:again
复制代码
|