Bulk modification of file names under Windows

Source: Internet
Author: User

Work encountered the need to change the batch of rules to rename the problem, check the use of batch processing can quickly solve the problem, recorded

Create a bat batch file Rename.bat with the following:

@echo off
Set a=00
Set b=10
Setlocal enabledelayedexpansion
For%%n in (*. JPG) Do (
set/a A = a + 1
If!a! LSS!b! (ren "%%n" "00!a!". JPG ") Else (ren"%%n "" 0!a!. JPG ")
)

The result is a batch modification of Rename.bat in the directory where the suffix named JPG is 001.jpg 002.jpg ... 011.jpg ..... (Number of documents not exceeding 99)

echo off-turn off Echo

Setlocal enabledelayedexpansion-Set Local to delay extension A for delay variable, use required!!

Compare numeric sizes:

EQU-equals

NEQ-Not equal to

LSS-Less than

LEQ-less than or equal to

GTR-Greater than

GEQ-greater than or equal to

Bulk modification of file names under Windows

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.