So, I'm making a calculator that allows its users to name their previous result in order to use them in future calculations. How it works is that when you give a name to a previous result, it creates a variable with the name chosen and its value is then set to whatever the previous result is. It looks something like this:
set /p equation=
::variables need to be replaced here
set /a result=%equation%
::giving a name
set /p name=
set %name%=%result%
The problem is, I cannot figure out a way to get the value of the variable in the equation since the equation is also a variable, so whenever I add the equation in a command with %equation%
, it just replaces it with something like 1+%named_result%
. Is there a way I could turn the equation with the same one but where the variables are replaced with their values? (set equation=%equation%
does not work)