Reading tab and new line characters
Posted: 03 Feb 2014 02:48
Hi folks,
I am working on a simple script that can read a file and display contents line-by-line. The following script (from another thread here) doesn't display the new line and tab characters in the read file. My hunch is that the solution is rather simple, but I can't seem to figure it out. Could you please help?
Thanks!
-Steph
test.bat is here:
filename.txt is here:
I am working on a simple script that can read a file and display contents line-by-line. The following script (from another thread here) doesn't display the new line and tab characters in the read file. My hunch is that the solution is rather simple, but I can't seem to figure it out. Could you please help?
Thanks!
-Steph
test.bat is here:
Code: Select all
@echo off
setlocal enabledelayedexpansion
for /f "tokens=*" %%a in ('type filename.txt') do (
set line=%%a
echo !line!
PAUSE>NUL|SET /P=
)
filename.txt is here:
Code: Select all
header1
sam
bob
stephen
header2
sam
bob
stephen