rem We have Phyton but let's check if it's in the PATH
:HASPYTHON
@echo %version% Phyton is found, checking PATH variable
rem Check Phyton install path
set install_path=
for /f "tokens=2,*" %%a in ('reg query "hklm\SOFTWARE\Python\PythonCore\%version%\InstallPath"') do (
set install_path=%%b
)
set test=%install_path:~0,-1%
call %running_directory%inPath test && (@echo %test% is already in PATH) || (call %running_directory%addPath test & setx PATH "%PATH%;%test%" /m & @echo %test% set to PATH)
set test=%install_path%Scripts
call %running_directory%inPath test && (@echo %test% is already in PATH) || (call %running_directory%addPath test & setx PATH "%PATH%;%test%" /m & @echo %test% set to PATH)
GOTO PIP_CHECK
rem Check whether PIP is installed or not
:PIP_CHECK
@echo.
@echo Checking if PIP is installed
IF EXIST %install_path%Scripts/PIP.exe GOTO PIP_VERSION_CHECK
@echo No PIP found, commencing PIP install
call phyton %running_directory%get-pip.py
rem Try to update the PIP
:PIP_VERSION_CHECK
@echo PIP is found
@echo Checking whether the latest PIP is installed
call python -m pip install --upgrade pip
GOTO SELENIUM_CHECK
rem Check if Selenium is installed
:SELENIUM_CHECK
@echo.
@echo Check whether selenium is installed
for /f "tokens=1,2 delims===" %%a in ('call python -m pip freeze') do (
if "%%a"=="selenium" (
@echo %%b Selenium is found
GOTO SELENIUM_UPDATE
)
)
@echo No Selenium version is found, commencing install