cn-dos forum saw many good batch renaming batch processing, but the experts all used set... I don't understand, so I made one that I can understand, but the efficiency is relatively low. I didn't use the set command!
\\\\\\\\\\\\\\\\\\\\\\\\\\Batch Rename 1.bat \\\\\\\\\\\\\\\ (Rename to 1 2 3...10 11, etc.)
@echo off
ren *.jpg *.[jpg]
for /l %%a in (1,1,10000) do (
ren *.[jpg] final-%%a.jpg
if not exist *.[jpg] cls &color 0b &echo OK!! &pause &exit
)
\\\\\\\\\\\\\\\\\\\\\\\\\\Batch Rename 2.bat \\\\\\\\\\\\\\\ (Rename to 001 002 003..., etc.)
@echo off
ren *.jpg *.[jpg]
for %%a in (0 1 2 3 4 5 6 7 8 9) do (
for %%b in (0 1 2 3 4 5 6 7 8 9) do (
for %%c in (0 1 2 3 4 5 6 7 8 9) do (
color %%b%%c
ren *.[jpg] final-%%a%%b%%c.jpg
if not exist *.[jpg] cls &color 0b &echo OK!! &pause &exit
)
)
)
\\\\\\\\\\\\\\\\\\\\\\\\\Final Batch Rename.bat \\\ (Can choose the type, file type, start of the rename sequence, such as a001, a002)
::If there are deficiencies (that can be improved), welcome to complain or correct hi.baidu.com/523066680
@echo off
mode con cols=77 lines=12
title A batch processing beginner hi.baidu.com/523066680
color 0b
::======================================================================
echo.
echo.Step 1: Enter the beginning of the new file name here, you can directly press Enter (that is, rename to 000 001 002) or (0 1 2)
echo. If you enter a, it will be renamed to a000 a001 a002..... or a0 a1 a2......
echo.
echo.Special symbols ^> ^< ^\ ^/ ^? ^" ^: ^| ^* are not supported. Do not enter spaces after entering the name. This batch processing does not judge.
echo.
set /p no1=Please enter:
::======================================================================
cls
echo.
echo.Step 2: Enter the format of the file to be renamed here
echo.
echo.
echo.Special symbols ^> ^< ^\ ^/ ^? ^" ^: ^| ^* spaces are not supported, or directly press Enter. This batch processing does not judge. &echo.
set /p no2=Please enter:
if not exist *.%no2% (cls &echo There is no file in %no2% format, please enter correctly, press any key to exit &pause>nul &exit)
if /i %no2%==bat (cls &echo Renaming bat format files is not supported (this file will be renamed, resulting in....) &pause &exit)
cls
::======================================================================
:Second
cls
echo.When executing, if it shows "There is a duplicate file or the file is not found", please do not close it immediately, wait for execution
echo.
echo.Select mode a: Rename to 000 001 002, limited to 999 files (can be changed)
echo.Select mode b: Rename to 1 2 3 4 5 ...., limited to 10000 files (can be changed)
echo.
set /p action="Enter here:"
if /i "%action%"=="a" (goto :ren1-1)
if /i "%action%"=="b" (goto :ren2-1) else (goto :second)
::======================================================================
:ren1-1
cls
ren *.%no2% *.[%no2%]
for %%a in (0 1 2 3 4 5 6 7 8 9) do (
for %%b in (0 1 2 3 4 5 6 7 8 9) do (
for %%c in (0 1 2 3 4 5 6 7 8 9) do (
color %%b%%c &title %%a%%b%%c.%no2%
echo. %no1%%%a%%b%%c.%no2%
ren *.[%no2%] %no1%%%a%%b%%c.%no2%>nul 2>nul
if not exist *.[%no2%] cls &color 0b &echo OK!! &pause &exit
)
)
)
::=======================================================================
:ren2-1
ren *.%no2% *.[%no2%]
for /l %%a in (1,1,10000) do (
echo. %no1%%%a%no2%
ren *.[%no2%] %no1%%%a.%no2%>nul 2>nul
if not exist *.[%no2%] cls &color 0b &echo OK!! &pause &exit
)
Recent Ratings for This Post
( 1 in total)
Click for details
| Rater | Score | Time |
| abcd |
+3 |
2008-02-24 12:52 |