我在文件夹中有许多文件格式filefirst_131202.txt
,只有下划线更改后的数字。
我想将文件重命名为filefirst_us_131202.txt
。即,为该文件夹中的所有文件添加“_us”。
尝试执行以下命令,但它不起作用。任何人都可以帮忙..
ren filefirst_*.txt filefirst_us_*.txt
expected Output : filefirst_us_131202.txt
filefirst_us_131203.txt
执行命令后的实际输出为:
filefirst_us_202.txt
filefirst_us_203.txt
答案 0 :(得分:0)
这假设文件名中只有一个下划线:
@echo off
for /f "tokens=1,* delims=_" %%a in ('dir *_*.txt /b ') do ren "%%a_%%b" "%%a_us_%%b"