0
votes

I have 2 txt files, first file is "recipes.txt", second is "sites.txt" where is website links, i'm making txt files in a bulk with the names from file "recipes.txt", from second txt file "sites.txt" i want to take rows in a loop and input them into txt file which gonna be created from recipes.txt.

Here i have batch script, which creates files with specific name from "recipes.txt", but its appending only last row of the file "sites.txt".

What shoudl i change to amke it work properly?

@echo off setlocal enableDelayedExpansion

for /f %%g in (recipes.txt) do (

    for /f %%i in (site.txt) do (   

    (
        echo SET !REPLAYSPEED MEDIUM
        echo URL GOTO=%%i
    )

)>C:\Users\Viktor\Desktop\Sites\Scripts\%%g".iim"

)
pause >nul
1

1 Answers

1
votes

just extend your block for redirection to include the for itself:

for /f %%g in (recipes.txt) do (
  (
    for /f %%i in (site.txt) do (   
      echo SET !REPLAYSPEED MEDIUM
      echo URL GOTO=%%i
    )
  )>C:\Users\Viktor\Desktop\Sites\Scripts\%%g".iim"
)
pause >nul

Your version overwrites your file with every iteration of %%i