【发布时间】:2017-07-21 12:39:35
【问题描述】:
我有一个文件 destination.txt,其中包含有关我的 CD 的路径信息:
C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\SME99.ISO
C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\Biomasse.iso
C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\SAMPE36.ISO
现在我必须用 PPN.txt 文件中的数字一个接一个地重命名 ISO:
470692405
394006801
348117876
应该是这样的
SME99.ISO -> 470692405.ISO
Biomasse.iso -> 394006801.ISO
Sampe36.ISO -> 348117876.ISO
我有以下代码:
< "PPN.txt" (for /F "usebackq delims=" %%a in ("destination.txt") do (
set/P out="" & rename "%%a" "!out!%%~xa"
我想修改代码,使其适用于文件destination.txt:
Success on: "C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\SME99.ISO"
Error on: "C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\Biomasse.iso"
Success on: "C:\Users\NekhayenkoO\Desktop\LOG Dateien CD Imaging\SAMPE36.ISO"
如果“Success on”保留在destination.txt 中的路径之前,则应像往常一样仅使用PPN.txt 中的数字重命名图像。 但是,如果“Error on”停留在destination.txt 中的路径之前,则应将图像重命名为 PPN.txt% 中的 e_%number 。所以应该有额外的前缀e_
【问题讨论】:
标签: batch-file for-loop rename