DOS commands batch change file names (including spaces, etc.)

1. Use DOS commands to list all source file names (including paths) and redirect them to the file a.txt

dir /s/b >>a.txt

2. Copy and paste all the file names in a.txt into the excel sheet, each file will occupy a separate cell.

3. Copy and paste the content in the cell to another column, and remove the full path, leaving only the file name (target file name);

4. Find a way to form each line into the following format, copy the whole to Notepad, and then paste it into the CMD command line to complete the overall renaming:

rename "D:\Downloads\aaa.docx" "aaa-0912.docx"

Rename files RENAME, REN.

RENAME [drive:][path]filename1 filename2.
REN [drive:][path]filename1 filename2.

Guess you like

Origin blog.csdn.net/qq_27866305/article/details/126836450