I am trying to write a script that will receive a .txt file and a path as arguments. The .txt file contains names of files, which I need to concatenate with the path.
File contains :
example1.txt
example2.txt
The path is :
C:\test
The output should be :
C:\test\example1.txt
C:\test\example2.txt
The problem comes when I try to use the "i" variable from the for loop in order to concatenate the strings:
@echo off
setlocal EnableDelayedExpansion
set file=%~1
set path=%2
for /F "tokens=*" %%i in (%file%) do (
echo %%i rem this displays the line correctly
set "line=%path%\%%i" rem this doesn't work
echo %line% )
What am I supposed to do there in order to get it to work as described above?