DOS Bulk replacement of the current directory suffix name implementation code _dos/bat

Source: Internet
Author: User
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

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.