I'm trying to make a self-building chatbot that learn questions by inputing question and three possible answers, then, it randomize that three answers and give it as output. The learned question goes to the final line of the same batch file.
Here's the sample:
@echo off&&setlocal enabledelayedexpansion
echo/teach me a question to answer.
set/p q=
echo(>>%~f0
echo/:%q: =%>>%~f0
cls
echo/teach me three ways to answer it.
set/p a1=
set/p a2=
set/p a3=
echo/set a[0]=%a1%>>%~f0
echo/set a[1]=%a2%>>%~f0
echo/set a[2]=%a3%>>%~f0
echo/"set/a ax=%random% %%3&&set aa=!a[%ax%]!">>%~f0
echo/"echo %aa%">>%~f0
But I get the following:
:howareyou?
a[0]=good
a[1]=fine
a[2]=well
"set/a ax=24793 %3&&set aa="
"echo "
It's possible to get
set/a ax=%random% %%3&&set aa=!a[%ax%]!
echo %aa%
exactly as it is?