1、创建Excel,在A列键入(或获取)想要修改的文件的文件名,在B列键入新文件名
2、创建宏,代码如下:
Sub 批量修改文件名()
Dim ipath As String
Dim itype As String
Dim oname, nname As String
ipath = "E:\文件\word" '文件所在的文件夹
itype = ".docx" '文件的拓展名
For i = 1 To Cells(Rows.Count, "A").End(3).Row '从A列第1行到最后一行
oname = ipath & "\" & Cells(i, 1).Value & itype '原文件名
nname = ipath & "\" & Cells(i, 2).Value & itype '新文件名
Name oname As nname
Next i
End Sub
3、保存并运行宏即可。
参考文章:https://www.zhihu.com/question/268456742/answer/337614430