【发布时间】:2019-02-14 18:38:13
【问题描述】:
我有一个文件“codes.txt”,每行包含一个代码。
我正在尝试在文件夹中搜索并重命名包含名称中包含代码的所有文件,以及另一个字符串:
@echo off
for /F "tokens=*" %%b in (codes.txt) do (
// If file names in folder contain %%b and "foo", rename to %%b.'string'
// If file names in folder contain %%b and "foo2", rename %%b.'string2'
)
谢谢
【问题讨论】:
-
codes.txt中的代码是什么,foo 在%%b的名称之前还是之后?还是两者兼而有之? -
代码将是这样的,纯数字:3614271992932。foo 可以在 %%b 之前或之后,具体取决于文件名。
标签: batch-file rename batch-processing batch-rename