Reputation: 251
I need to check in my batch script what python --version
response is.
For that, I want to enter to a variable the output of the python --version
commands :
set /u cmd=python --version
%cmd%
What should i do next ?
Upvotes: 1
Views: 216
Reputation:
Use a for loop.
for /f "delims=!" %%i in ('python --version') do set VAR=%%i
echo %VAR%
I changed %cmd% to %VAR% as it is a bad idea to set
variable names that resemble system commands such as cmd
which is in fact cmd.exe
Upvotes: 2