DOS Bulk replace the current directory suffix name implementation code

Source: Internet
Author: User
Sometimes some suffix names don't meet the criteria, on the need for batch replacement, if man-made to replace, then if the quantity is not good enough to say, a lot of words to replace it is too silly, today from the network to find some of the batch replacement of the DOS command, with a pretty good use, directly put the code on this side

Sometimes some suffix names do not meet the conditions, you need to do batch replacement, if man-made to replace, then if the quantity is not good enough to say, a lot of words to replace it is too silly, today from the network to find some of the batch replacement of the DOS command, with a pretty good use, the code directly posted on this side.

For example, sometimes the name of the suffix is jpeg, but some sites for security, direct restrictions can only upload jpg suffix, this time you can use this batch replacement tool.

Copy Code code as follows:


@echo off
set/p filename= Please enter the suffix name to replace:
Echo.
set/p filename2= Please enter the replacement suffix name:
Echo.
Setlocal enabledelayedexpansion
for/f "tokens=*"%%i in (' dir/b *.%filename% ') do (
for/f "Tokens=1 delims=."%%j in ("%%i") do Ren "%%i" "%%j.%filename2%"
)
Echo Replacement succeeded! Press any key to launch
Pause

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

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.