Here is significantly more efficient method to get Endoro's result. It will encode any length text in only 26 iterations.
@echo off
setlocal enableDelayedExpansion
set "text=This is my zero text example"
set "code=!text!"
set "chars=0abcdefghijklmnopqrstuvwxyz"
for /l %%N in (1 1 26) do for /f %%C in ("!chars:~%%N,1!") do set "code=!code:%%C=%%N !"
echo !text!
echo !code!
But please note that both solutions fail to distinguish between upper and lower case. In addition, my simple substitution algorithm would be difficult to extend to support numeric characters in the input.
Way back when I wrote a library of batch string processing routines called CHARLIB.BAT. One of the routines efficiently converts a character into its ASCII code. Development of the library is documented at new functions: :chr, :asc, :asciiMap . The final code can be downloaded from https://sites.google.com/site/dbenhamfiles.
I have also developed a library of batch macros that is even more efficient at dealing with ASCII codes: Batch macros to convert between ASCII code and character. Batch macros are a specialized technique to pass arguments to batch code that is stored in environment variables. It totally avoids the relatively slow process of the CALL command. A group of us developed the technique at DosTips.