hi..
i am trying to create a batch file which will copy the first line of a file from a list of file to a temporary file with an extra field. but when i am using a goto command inside a for loop its giving error.
the code is as below
@echo off
setLocal EnableDelayedExpansion
dir /b/a-d c:\my_folder > c:\rfile.txt
for /f %%i in (c:\rfile.txt) do (
for /f “delims=$” %%j in (c:\my_folder\%%i) do (
echo %%j,filename >> c:\my_folder\temp_%%i
goto fin
)
:fin
)
can anybody tell me how to do this??
thanks in advance
roy
weirdism of neuvo-batch: no colon/labels next to “)”
move :fin outside the last “)”, or do else to make it not
right next to the “)”. No clue as to the reason… question NOT the almighty MicroSoft!!!
::——
for /f %%i in (c:\rfile.txt) do (
for /f “delims=$” %%j in (c:\my_folder\%%i) do (
echo %%j,filename >> c:\my_folder\temp_%%i
goto fin
)
)
:fin