- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir/a-d/s/b/l/on "%~dp0\新建文件夹\*.*"')do (
- if not defined n set "n=0"
- set "name=%%~ni"
- set "name=!name:a=!"
- set "name=!name: =!"
- set/a "n+=1"&set/a "name_n+=1"
- rem:此处回显完整路径对比,可以删除此行,
- echo=源文件: %%i
- if !n! leq 2 echo,新文件: %%~dpi!name!%%~xi
- if !n! equ 2 set "n=0"
- )
- echo,文件数据总数: %name_n%
- pause
复制代码
|