2

I have two .txt files. The first one contains the list of pathes to the CD-Images:

C:\Users\N\Desktop\LOG_Dateien_CD_Imaging\BFU_KONGRESS_9.ISO   
C:\Users\N\Desktop\LOG_Dateien_CD_Imaging\NDC2005.ISO 

The second one contains the new names for this files

490628001
684654326 

So the file BFU_KONGRESS_9.ISO in the directory (not in the .txt file!) should be renamed to 490628001.ISO and NDC2005.ISO to 684654326.ISO. The renaming should go line per line

Oleg_08
  • 447
  • 1
  • 4
  • 23

1 Answers1

3

you need a way to read two files in parallel:

@echo off
setlocal enabledelayedexpansion

<out.txt (
  for /f "delims=" %%a in (in.txt) do (
    set /p out=
    echo rename "%%~a" "!out!"
  )
)

Another way: read both files (one after the other) into two arrays and then work with the array variables, but it's more code and might have issues with very large files.

Stephan
  • 53,940
  • 10
  • 58
  • 91