- Jul 4, 2009
I grab a line from a text file to a variable and output it to another. Example: DO line IN @file1.txt echo %line >> file2.txt ENDDO It has a problem: special characters like " ` < > | and long lines (is there a variable length limit?) are not appended to the file but are printed on screen. How do make it do the job properly (like it does when the lines aren't too long and don't contain special characters)? As a workaround, I'm replacing all occurrences of special characters, like " with ---doublequote---, and then replacing them back to original when the echoing is done. If this is the only way, how would I do that for all special characters in a whole file? Got code? Now I'm doing it manually in text editor, and perhaps will record a macro for it. How do I remove the appended lines from the original file?