In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
In this article Xiaobian for you to introduce in detail the "BAT script batch modification of the file name of the methods", detailed content, clear steps, details handled properly, I hope that this "BAT script batch modification of the file name of what methods" article can help you solve doubts, the following editor's ideas slowly in-depth, together to learn new knowledge bar.
There are two ways to modify file names in batches through BAT scripts:
First, go to the folder where you want to change the file name and use the command: dir / b "*. Suffix name" > yuan.xls
Generate a xls file (that is, an Excel file) with the desired filename from, and then pass the
CONCATENATE ("ren", A2, "", B2)
To generate the corresponding cmd command, where A2 is the box of the original file name, B2 is the box of the new file name, and then copy the cmd command
To the text document (the text document should be in the same directory as the file name to be changed), save and modify the suffix .bat, and double-click to execute it.
The specific steps are as follows:
1. Take the example document as an example.
(1) double-click to produce a sample file. Bat to run it (or right-click to open it). The sample code is as follows:
@ echo offset / p w = Please enter the format in which you want to generate the sample file (that is, the extension ends with an enter): set a=0:loopset / an a+=1type nul > waste Brothers% a% set.% w%if% a% = = 20 goto endgoto loop:end
As shown below:
(2) enter the format of the generated sample file (such as txt)
2. Double-click 1.bat to generate the yuan.xls file, as shown below:
Step 1:
Step 2:
Because the sample file is taken as an example, it is txt. If it is a video file, it can be in its corresponding format (such as mkv, MP4).
Step 3:
Locate the generated yuan.xls file and open it:
Step 4:
Copy the file name in column An in the yuan.xls file to the corresponding column An in renamed .xls, and add the file name to be changed in column B, as shown below:
Step 5:
In column B (that is, the new file name), fill in the file name that you want to change (for example, change waste firewood brother to waste firewood):
Step 6:
Generate the corresponding cmd command:
Step 7:
Create a new blank txt document and fill in the contents of column C in renamed .xls:
Step 8:
Change the extension of the new text document to bat (that is, new text document .txt à new text document .bat)
Step 9,
Double-click (or right-open) to create a new text document .bat to change the file name
Modification completed
Second, it is directly realized through BAT script.
This is achieved through the for loop and character manipulation of bat. The specific code is as follows:
@ echo offset / p w = Please enter the file format (i.e. extension and end with enter): set / p wf= Please enter the text to be modified (ending with enter): set / p cb= Please enter the text to be changed (if deleted, enter directly Ends with enter): for / f "delims="% I in ('dir / b / a murd "*.% w%"') do (set str1=%%i setlocal EnableDelayedExpansionset "str1 examples str1lug% wf% carriage% CB%!" ren "%% I"! str1! "endlocal) pause
Generally speaking, the first method is intuitive, but troublesome, and the second method is simple, but not intuitive.
Read here, this "BAT script batch modification of file names what are the methods" article has been introduced, want to master the knowledge of this article also need to practice and use in order to understand, if you want to know more about the article, welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.