Solved Reading and Writing text file using windows batch

September 9, 2015 at 14:14:51
Specs: Windows 64
I had a txt file which has a line of 135 char length each, I need a windows batch whic will read the input file line by line and writ it to the output txt file by splitting the line in to tw like 72 char and 64 chars, ie splitting the line in to two and writing it out

See More: Reading and Writing text file using windows batch

Report •


#1
September 9, 2015 at 22:47:13
When I add 72+64 I get 136.
What am I missing here?

=====================

M2 Get custom script or take private lessons


Report •

#2
September 9, 2015 at 23:06:08
✔ Best Answer
This gets 72 and 'the rest', whatever 'the rest' happens to be.

::====== script starts here ===============
::
:: Dansplit.bat 2015-09-10 12:55:13.79
@echo off > NEWFILE & setLocal enableDELAYedeXpansioN

:main
for /f "tokens=* delims= " %%a in (myfile) do (
set S=%%a
set H=!S:~0,72!
set T=!S:~72!
echo.!H!
echo.!T!
) >> NEWFILE
goto :eof
::====== script ends here =================

=====================

M2 Get custom script or take private lessons


Report •

#3
September 10, 2015 at 07:12:55
Thanks a Bunch Mechanix2Go, This helps

Report •
Related Solutions


Ask Question