How to rename the files in the path with the new names from the .txt file in batch?

后端 未结 1 1895
情深已故
情深已故 2021-01-23 03:46

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         


        
相关标签:
1条回答
  • 2021-01-23 04:11

    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.

    0 讨论(0)
提交回复
热议问题