Code
1 @ echo on
2 setlocal enabledelayedexpansion
3CD F: \ movie \ complete video set
4dir *. srt/S/a-d/B> temp.txt
5
6 set filename = ""
7 set tempname = ""
8 set COUNT = 1
9for/F % I in (temp.txt) Do (
10 set filename = % I
11 echo! Filename!
12 set filename =! Filename :~ 18!
13 set tempname =! Filename!
14 call: stringlenth "! Filename! "Count
15 echo! Count!
16 if! Count! LSS 8 set tempname = traveled all over the United States! Filename!
17 echo! Filename!
18 echo! Tempname!
19 Ren "! Filename! ""! Tempname! "
20)
21
22 endlocal
23
24 exit
25
26: stringlenth
27
28 set thestring = % ~ 1
29if not defined thestring Goto: EOF
30 set return = 0
31: stringlenth_continue
32 set/a return + = 1
33 set thestring = % thestring :~ 0,-1%.
34if defined thestring goto stringlenth_continue
35if not "% 2" = "" set % 2 = % return %
36 Goto: EOF
37
38rem Delete temporary file del temp.txt/Q 1> NUL 2> nulpause
39
40rem summary use latency variables in a For Loop
Since I have downloaded videos from all over the United States, and subtitles have to be downloaded separately, the downloaded letters are different from the video file name, so I need to add four more words to travel across the United States,
I wrote the above batch to modify it, just to learn batch processing. There are 78 files in total.
Some code is useless, just for debugging
If you understand the syntax, it does not seem very troublesome.