Say I have the command:
python --version > PythonVersion.txt
A file called PythonVersion.txt is created. In my case the contents are "Python 3.9.13".
Can the output of a command be saved as a variable? I'd like to be able to do something like the following:
@echo off
set "PythonVersion=python --version"
echo Your Python installation is: %PythonVersion%
The expected output might be Your Python installation is: Python 3.9.13, but of course the above script isn't valid and produces Your Python installation is: python --version.