Batch file to read files [Solved/Closed]

Report
-
 ani -
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 replies

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
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 4223 users have said thank you to us this month

Instead of echo try with


type %%i will print the contents..