首页 > 解决方案 > 在 CMD 中重命名多个文件名

问题描述

我的每个文件都有我想替换的同一个月。

问题是月份在中间和空格之后。它看起来像这样apple Oct'18.xlsx

基于此网站, https://superuser.com/questions/475874/how-does-the-windows-rename-command-interpret-wildcards

我试着用ren ??????Oct???*.xlsx ??????Nov???*.xlsx

标签: cmd

解决方案


使用 PowerShell 作为-replace操作员的工具非常容易

Powershell -NoP -C "Dir '* Oct*.xlsx'|Ren -NewName {$_.Name -Replace ' Oct',' Nov'}

样本输出贷款 aschipfl 的模板

and some pears Nov'18_xyz.xlsx
apples Nov'18.xlsx
bananas Nov'18.xlsx
more fruit Nov'18_xyz.xlsx
oranges Oct'18.xls2x
plus peaches Nov'18_xyz.xlsx
strawberries Nov'18 abc.xlsx

推荐阅读