Replace the specified string in the folder name for batch processing. Replace the string

Source: Internet
Author: User

Replace the specified string in the folder name for batch processing. Replace the string

@ Echo off & color 3a & set c = 0123456789 abcdefghijklmnopqrstuvwxyz

Batch replacement of file (folder) names by title

Echo.

Echo this batch can replace the file names of all files in the folder where this file is located in batches.

Echo.
Echo. & set/p strtemp1 = enter the name string of the file (folder) to be replaced (spaces can be replaced ):

Echo. & set/p strtemp2 = enter the string of the replaced file (folder) name (Press enter to delete the string ):

For/f "delims =" % I in ('dir/s/B ') do (
Setlocal enabledelayedexpansion
Set "f = % ~ Nxi"
Set "f1 =! F: % strtemp1 % = % strtemp2 %! "
If not "% I" = % 0 (
If not "! F! "= "! F1! "(
If exist "! F1! "(
Echo because! F1! The same name exists ,! F! File name not changed) else ren "! F! ""! F1! "
)
Endlocal
)
)

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.