Windows batch split long string by length 64

I have tried to figure this out without any luck. Can anyone help on this?

I have a file: input.txt This file contains a long string - and i want to split the long string into 64 long string chunks, and save the content to a different file.

I don't have much so far, i know i have to use the for loop:

echo off
set /p base64=<input.txt

for /f "%base64:~0,64%" %%G IN %base64% DO echo %%G

But how to make the loop for each 64 characters in line - and in a batch script?

Any help will be appreciated.


FOR /f "delims=" %%i IN (input.txt) DO SET longline=%%i&call:breakit
GOTO :eof

ECHO %longline:~0,64%
SET longline=%longline:~64%
IF DEFINED longline GOTO breakit

This should do what you want - but it may depend on the content of the file as batch has sensitivities to certain characters.

Need Your Help

memorable name generator gem for ruby

ruby-on-rails ruby ruby-on-rails-3 rubygems gem

Before I go roll my own and start pulling out the dictionary, does anyone know a rubygem to generate memorable names suitable for app keys. I need something pronounceable so that I can give users ...

Chained Selects with Jquery Ajax

php jquery html ajax

I new to programming, and have just finished the jquery course on CodeAcademy.I'm currently trying to create a chained select using Jquery's AJAX function to call a php page which runs a query on my