Windows batch processing-file name modification tutorial, batch processing file name
Purpose
You can batch modify a regular file name for any file name, as shown below:
Rename by keith.gif
Usage
Create a new file (.txt), copy the following code, save it, and change the file suffix to. bat. Put it in the folder where the files you want to operate in batches. Double-click the file.
Implementation Code
@ Echo offsetlocal enabledelayedexpansioncolor 0 ATITLE keith batch rename toolECHO. ECHO ================================================ ECHO welcome to use keith for batch naming tool ECHO ====================================== ECHO. for ECHO, select the suffix ECHO. ECHO 1. all files (only the file name will be modified) ECHO 2. txtECHO 3. pngECHO 4. others: Input ECHO. CHOICE/C 1234/m "your CHOICE is:" IF % ERRORlEVEL % equ 1 SET suffix = * IF % ERRORlEVEL % equ 2 SET suffix = txtIF % ERRORlEVEL % equ 3 SET suff Ix = pngIF % ERRORlEVEL % equ 4 (ECHO. SET/P suffix = "Enter the suffix of batch processing:") ECHO. SET/p prefix = "Enter the start of the file name you modified to:" ECHO. ECHO modify ing... ECHO. SET/a index = 0FOR % I in (*.! Suffix !) Do (SET/a index =! Index! + 1 SET name =! Prefix !! Index !.! Suffix! REN "% I "! Name !) IF % ERRORlEVEL % equ 0 (ECHO modification successful !) ELSE (ECHO modification failed !) ECHO. PAUSE