cmd – How do I test if Python is installed on Windows (10), and run an exe to install it if its not installed?

cmd – How do I test if Python is installed on Windows (10), and run an exe to install it if its not installed?

  1. Open Command Prompt > Type Python Or py > Hit Enter
    If Python Is Installed it will show the version Details Otherwise It will Open Microsoft Store To Download From Microsoft Store
  2. Just go in cmd and type where python if it installed it will open a prompt .

Sometimes it may not work if environment variable is not set up, so you can also check by where python in cmd. If where python returns something hot to that path and see for python.exe

All of the comments guided me to the right way to do it.

I used this great working code:

:: Check for Python Installation
python --version 3>NUL
if errorlevel 1 goto errorNoPython

:: Reaching here means Python is installed.
:: Execute stuff...

:: Once done, exit the batch file -- skips executing the errorNoPython section
goto:eof

:errorNoPython
echo.
echo Error^: Python not installed
C:Program Filesusedsystemsinnoventiqaccumanagerrequiredexcutablespython-3.7.3-amd64.exe

cmd – How do I test if Python is installed on Windows (10), and run an exe to install it if its not installed?

Leave a Reply

Your email address will not be published.