Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch    |    Fun with MS-DOS batch files    |    42,547 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 41,132 of 42,547    |
|    Herbert Kleebauer to Ferlin Short    |
|    Re: Add Carriage Return and Line Feed ev    |
|    21 May 15 22:14:29    |
      From: klee@unibwm.de              On 21.05.2015 18:04, Ferlin Short wrote:       > On Friday, May 15, 2015 at 8:56:01 AM UTC-7, Ferlin Short wrote:              >> I'm struggling with writing a batch file that will take a filename as the       >> only parameter, reading the file contents and inserting a carriage return       >> and line feed every 128 characters              > The contents of the file can be anything in the West European character set,       > including alpha-numeric and special characters. There are no carriage returns       > or linefeeds, so I guess you could call it 'one line.' And that line length       has no limit.              Then try your code:              > @echo off       > setlocal enabledelayedexpansion       > set x=       > for /f "tokens=*" %%a in (%1) do set x=!x!%%a       > :NEXTLINE       > >>output.txt echo %x:~0,128%       > set x=%x:~128%       > if "%x%" neq "" goto :NEXTLINE              with this input:              aa!<>|%aaaa              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca