a6236130 当前离线
二级士官
TOP
aloha20200628 当前离线
上尉
@echo off (for /f "delims=" %%d in ('dir /b/s/ad') do ( cd /d "%%~d" dir /b/ad|findstr ".*">nul||echo,%%d ))>"末级目录列表.txt"复制代码
WHY 当前离线
上校
PowerShell "dir -Literal '%~dp0' -Recurse -Dir | ?{!$_.GetDirectories().Count} | forEach{$_.FullName}"复制代码
@echo off for /d /r "%~dp0" %%i in (*) do ( set "flag=" for /d %%j in ("%%~i\*") do set "flag=1" if not defined flag echo;%%i ) pause复制代码
terse 当前离线
中将
@echo off >new_txt.txt (for /f "delims=" %%i in ('dir /b /ad') do ( call :getfolder "%%~i" "d" call echo %%d%% )) pause&exit :getfolder (for /f "delims=" %%a in ('dir /ad/b "%~1\"') do call :getfolder "%~1\%%a" %2)||set "%~2=%~1"&exit /b复制代码
qixiaobin0715 当前离线
大校
@echo off for /f "delims=" %%a in ('dir /s /b /ad') do ( dir /b /ad "%%a"|findstr .>nul 2>nul if errorlevel 1 echo,%%a ) pause复制代码
hfxiang 当前离线
@echo off rem 保存为ANSI编码格式 setlocal enableDelayedExpansion cd /d "%~dp0" set A=%~f0 ( for /f "delims=" %%a in ('dir /b/s/ad^|sort/r') do ( if "!A!" NEQ "%%~fa\" echo;%%~na set A=%%~dpa ) )>dir_name.txt endlocal复制代码
77七 当前离线
中校
@echo off cd /d "%~dp0" for /f "delims=" %%i in ('dir /b /ad') do ( pushd "%%i" set n= for /f "delims=" %%a in ('dir /b /s /ad ^| sort /r') do ( if not defined n ( echo %%~na set n=1 ) ) popd )>>名称.txt pause复制代码