全盘搜索指定文件并拷贝到指定位置[自动重命名]的批处理


复制代码 代码如下:

@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

« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3