SET origfile="C:\Documents and Settings\user\Desktop\test1\before.txt"
SET tempfile="C:\Documents and Settings\user\Desktop\test1\after.txt"
FOR /F %%C IN ('FIND /C /V "" ^<%origfile%') DO SET totallines=%%C
<%origfile% (FOR /L %%i IN (1,1,%totallines%) DO (
SET /P L=
IF %%i==%insertbefore% ECHO(
ECHO(!L! I don't believe this fixed it for the OP so should not be accepted answer. Add new parameters into a line, and redirect the line to other file How can i add new parameters into a line, and redirect the line to other file? Here's my code: var1="Hello" var2="World!"
RENAME %tempfile% %origfile%