本帖最后由 terse 于 2023-5-21 13:12 编辑
看结果正确不
修正一下- @echo off
- for /f "tokens=*" %%i in ('dir /b /a-d') do if defined :.%%~ni (set ":.%%~ni=")else set ":.%%~ni=%%i"
- set :.
- pause
复制代码
- @echo off&@echo off&setlocal enabledelayedexpansion
- for /f "tokens=*" %%i in ('dir /b /a-d') do set /a "_%%~ni+=1"
- for /f "tokens=*" %%i in ('dir /b /a-d') do if !_%%~ni! equ 1 if %%~ni neq %~n0 echo %%i
- pause
复制代码
|