the below code checks the python version and calls the other python script to excute. I want to take all the logs of the below bat file, including the output of the python script into another log file. doing some test, I am able to put the logs into the file but the output still prints command print window. i thought it will redirect the output.
setlocal
SET "parent=%~dp0"
set LOGFILE=%parent%\run.log
call :LOG > %LOGFILE% 2>&1
:LOG
set "$py=0"
set "$ms=0"
call:construct
for /f "delims=" %%a in ('python dele.py ^| findstr "2"') do set "$py=2"
for /f "delims=" %%a in ('python dele.py ^| findstr "3"') do set "$py=3"
del %parent%\dele.py
if %%py%% == 0 echo "python is not installed" & goto :EOF
echo running with python %py%
for /f "delims=" %%V in ('pip -V') do @set ver=%%V
echo %ver%
pip install --user -r %parent%\requirements.txt
[output on command prompt][1]
echo connectivity script is running...
python %parent%\ConnChk.py
echo connectivity check is completed
goto :EOF
:construct
echo import sys; print('{0[0]}.{0[1]}'.format(sys.version_info^)^)>dele.py
I dont want to print anything on cmd. is there a way? any help would be great!!
[output on cmd][1] [1]: https://i.sstatic.net/qC4pZ.png