home bbs files messages ]

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,124 of 42,547   
   Herbert Kleebauer to Ferlin Short   
   Re: Add Carriage Return and Line Feed ev   
   18 May 15 21:50:29   
   
   From: klee@unibwm.de   
      
   On 18.05.2015 16:49, Ferlin Short wrote:   
   > On Friday, May 15, 2015 at 11:13:17 PM UTC-7, foxidrive wrote:   
   >> On 16/05/2015 01:55, 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   
      
   > I can't use any other tools besides the batch file, and the characters in the   
   > file could be anything in the WE8MSWIN1252 West European character set.   
      
   You can't execute a batch file without the "tool" cmd.exe and certutil.exe   
   is just an other tool which is part of windows like cmd.exe.   
      
      
   @echo off   
   setlocal enabledelayedexpansion   
      
   set infile=%1   
   set outfile=%1.crlf   
      
   set tmp1=_1._   
   set tmp2=_2._   
      
      
   certutil  -f -encodehex %infile% %tmp1% 4 >nul   
      
   set n=0   
   if exist %tmp2% del %tmp2%   
      
   for /f "tokens=*" %%i in (%tmp1%) do (   
     echo %%i>>%tmp2%   
     set /a n=n+1   
     if !n! == 8 set n=0 &echo 0d0a>>%tmp2%)   
      
   certutil -f -decodehex %tmp2% %outfile% >nul   
      
   del %tmp1%   
   del %tmp2%   
      
   --- 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