Windows batch processing-file name modification tutorial, batch processing file name

Source: Internet
Author: User

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

Related Article

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.