I've creating a dos batch file to process a file of input records. I've cut out the majority of the code, so here is the problem. When it reads the 3rd record, with the ampersand, the job does not write the output record, UNLESS i put double quotes around the %%H
variable. However, when I do this, it adds the "
to the first and last byte of the record. I want to basically copy the record, and I'm doing some other processing as well.
Is there a way to either strip the " from the front and back that are being appended, or is there a way for ECHO to handle the ampersand? thanks!
The input file has three records:
HOW NOW BROWN COW
JACK AND JILL
JUST YOU & ME
Script is as follows:
set infile=D:\file.txt
set outfile=D:\outfile.txt
for /F "tokens=*" %%H in (%infile%) do (CALL :Loop "%%H")
rem for /F "tokens=*" %%H in (%infile%) do (CALL :Loop %%H)
GOTO :Loop_Exit
:Loop
echo %* >> %outfile%
:Loop_Exit
pause