Well, in theory, what you need to do would be:
1) get the decoded strings of a pre-existing string present in a given file
2) save this string/line obtained from the file in a variable
3) generate variable substring using space as delimiter, one by one
3) have access to the variables resulting from the substring in an accessible way
4) treat variable by variable in a predictive way, and ordering for defining each value
_ _ _ _
You can do is add (append) to your `bat` the strings in base64, this will occur (usually) will be on the last line, and your code will make the bat exit before executing this line as/equal to commands.
For this case, your program would not print the strings to a file (say "outputs_some_file.txt"), but would add the strings "<-----BEGIN -----" and "----END ----->" and append the bat itself:
<-----BEGIN -----[your_string_b64_came_here]-----END ----->
:: For example, this line would be added to your bat:
<-----BEGIN -----OSAxMSA4IDQgMTUgMjIgNyAzIDEgMjAgMiAxMiAyNiAyNCA1IDIzIDE4IDE3IDI1IDEwIDIxIDYgMTMgMTQgMTkgMTYNCg===-----END ----->
Your bat will decode the base64 strings contained in them in a separate file, and after that step, it takes this separate file and sets a variable (_string_0), with the decoded content.
Once this content is decoded and saved in a variable, this file is no longer useful, so as a dispensation, so we can create a copy of the bat without the base64 strings, to restore the bat to its original state/content, using move command.
Your bat without the line added by your program:
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0" && 2>nul set /a _i=-!_i!
>nul CertUtil -f -decode "%~f0" .\File.dat
set /p _string_0=<.\File.dat && findstr /vb ^< <"%~f0" >.\File.dat
set "_string_0=%_string_0: =" & set /a _i+=1+0 & set "_string_!_i!=%"
:: access anytime you need any of the 26 (_var_0 - _var_25) variables ::
for /L %%L in (0 1 !_i!)do echo\Your variable _string_%%L: !_string_%%L!
echo\use for example the fifth value/variable (!_string_5!) where you need, and
echo\use for example the thirteenth value/variable (!_string_13!) where you wanna
2>nul >nul move /y .\File.dat "%~f0" | endlocal & goto :eof
Your bat with the (last) line added by your program:
@echo off
setlocal enabledelayedexpansion
cd /d "%~dp0" && 2>nul set /a _i=-!_i!
>nul CertUtil -f -decode "%~f0" .\File.dat
set /p _string_0=<.\File.dat && findstr /vb ^< <"%~f0" >.\File.dat
set "_string_0=%_string_0: =" & set /a _i+=1+0 & set "_string_!_i!=%"
:: access anytime you need any of the 26 (_var_0 - _var_25) variables ::
for /L %%L in (0 1 !_i!)do echo\Your variable _string_%%L: !_string_%%L!
echo\use for example the fifth value/variable (!_string_5!) where you need, and
echo\use for example the thirteenth value/variable (!_string_13!) where you wanna
2>nul >nul move /y .\File.dat "%~f0" | endlocal & goto :eof
<-----BEGIN -----OSAxMSA4IDQgMTUgMjIgNyAzIDEgMjAgMiAxMiAyNiAyNCA1IDIzIDE4IDE3IDI1IDEwIDIxIDYgMTMgMTQgMTkgMTYNCg==-----END ----->
Outputs:
Your variable _string_0: 9
Your variable _string_1: 11
Your variable _string_2: 8
Your variable _string_3: 4
Your variable _string_4: 15
Your variable _string_5: 22
Your variable _string_6: 7
Your variable _string_7: 3
Your variable _string_8: 1
Your variable _string_9: 20
Your variable _string_10: 2
Your variable _string_11: 12
Your variable _string_12: 26
Your variable _string_13: 24
Your variable _string_14: 5
Your variable _string_15: 23
Your variable _string_16: 18
Your variable _string_17: 17
Your variable _string_18: 25
Your variable _string_19: 10
Your variable _string_20: 21
Your variable _string_21: 6
Your variable _string_22: 13
Your variable _string_23: 14
Your variable _string_24: 19
Your variable _string_25: 16
use for example the fifth value/variable (22) where you need, and
use for example the thirteenth value/variable (24) where you wanna
What you are doing is using a mixed set command with auto variable expansion based on a delimiter, in your case the space:
set "_string_0=%_string_0: =" & set /a _i+=1+0 & set "_string_!_i!=%"