# Parsing the input to a batch file with the for command



## mattslav (Aug 15, 2004)

I am "for" to parse the input (from a file given as the first parameter) to a batch file:

for /f %%g in (%1) do call :archive_data %%g

:archive_data starts immediately after this statement till the end of the file, then it returns to the for statement. It parses the input from the file the way I want it to, but after the file contents are exhausted it will run :archive_data with the name of the input file, i.e. 
run :archive_data with the first line of the input file, 
run :archive_data with the second line of the input file,
... , 
run :archive_data with the last line of the input file, 
run :archive_data with the name of the input file. 
Why is this happening?


----------

