Batch file to read files

Solved/Closed
trusp - Dec 10, 2008 at 06:39 AM
 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

2 responses

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
)
17
Instead of echo try with


type %%i will print the contents..
13