Fairly new to .bat programming I wanted to make a script that does some things according to the installed python version. However, I came across my first problem, when it comes to storing the python version, my script looks like the following until now:
set version="python --version"
echo %version%
Just gives back:
"python --version"
So the question cuts down to: How to save a a result from a comamnd line command into a variable in bat.file?
I only found this solution:
FOR /F "tokens=* USEBACKQ" %%F IN (`python --version`) DO (
SET var=%%F
)
ECHO %var%
By this question: How to set commands output as a variable in a batch file - which seems too much, if I compare it a bash file - so is there a more elegant way to store the results?