I developed a batch that cycles through the contents of the file and prints the value of the lines in another file, but I'm having problems with lines containing the "!" character.
Below is a simplified example of what I am doing and the result obtained:
Contents of the one-line example file "test_file.txt":
Code: Select all
TEST != TEST
Code: Select all
@echo OFF
setlocal ENABLEDELAYEDEXPANSION
for /F "usebackq delims== tokens=*" %%A in ("test_file.txt") do (
set sLine=%%A
echo.!sLine!
)
endlocal
exit /b %ERRORLEVEL%
Code: Select all
TEST = TEST
Can anyone tell me why and how to solve?
Thanks in advance, bye.