@echo off&setlocal enabledelayedexpansion set num=0 set /p filename=请输入要查找的文件名[包含文件扩展名]: set /p newpath=请输入所要拷贝到的指定目录: if not exist !newpath! md !newpath! 1>nul 2>nul set zh=!newpath:~-1! if !zh! NEQ "/" set newpath=!newpath!/ for %%a in (c d e f g h i j k l) do ( cd /d %%a:/ for /r . %%i in (*.exe) do ( if "%%~ni%%~xi"=="!filename!" set /a num=!num!+1 && copy "%%i" !newpath!%%~ni!num!%%~xi 1>nul 2>nul && echo %%i → %%~ni!num!%%~xi>>!newpath!filecopy.txt ) ) start !newpath!filecopy.txt