发布网友 发布时间:2022-04-27 02:44
共1个回答
热心网友 时间:2022-06-25 00:11
不清楚你的实际文件/情况,仅以问题中的样例/说明为据;以下代码复制粘贴到记事本,另存为xx.bat,编码选ANSI
@echo off
rem 将一个指定文件夹里的jpg图剪切/移动到另一个文件夹内的名称中包含有对应图片名称的子文件夹里
mode con lines=3000
set #=Any question&set @=WX&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$%/%@% %z%
cd /d "%~dp0"
set "folder1=图片"
set "folder2=姓名"
if not exist "%folder1%" (echo;"%folder1%" not found&pause&exit)
if not exist "%folder2%" (echo;"%folder2%" not found&pause&exit)
for /f "delims=" %%a in ('dir /a-d-h/b "%folder1%\*.jpg"') do (
for /f "delims=" %%b in ('dir /ad-h/b "%folder2%\*%%~na*" 2^>nul') do (
echo;"%folder1%\%%~nxa" --^> "%folder2%\%%~nxb"
)
)
echo;%#% +%$%%$%/%@% %z%
pause
exit