Batch file to read files [Solved/Closed]

trusp - Dec 10, 2008 at 06:39 AM - Latest reply:  ani
- Jan 25, 2010 at 12:04 AM
Hello,

I want to read a file and print the contents.
But the path of the file will be having space with it.

For loop not supporting those files when we
specify the path with space.

Please see this example for getting my req:

@ echo off
set TEXT_T="C:\R Test\text1.txt"
for /f "eol= tokens=* delims= " %%i in
(%TEXT_T%) do (
echo %%i
)

This is not displaying the file contents.
Instead displays the whole path.

All bcoz: R Test

So, Please help me out in this...

Thanks
Trusp
See more 

2 replies

Best answer
17
Thank you
try this:

@ echo off
set TEXT_T="C:\R Test\text1.txt"
for /f "eol= tokens=* delims= usebackq" %%i in
(%TEXT_T%) do (
echo %%i
)

Thank you, Zeta 17

Something to say? Add comment

CCM has helped 1700 users this month

13
Thank you
Instead of echo try with


type %%i will print the contents..