Created
September 18, 2020 17:38
-
-
Save gustavoleo/c4e97ee9b7a0c770784bbf5460fcac10 to your computer and use it in GitHub Desktop.
Batch to run Python script from cmd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
SET RUN_DOTPY=python.exe mercurial.py | |
SET PYTHON_PATH=C:\dev\Python27 | |
set SCRIPT= | |
REM Hunt around for python | |
IF EXIST "python.exe" ( | |
SET SCRIPT=%RUN_DOTPY% | |
) ELSE ( | |
IF EXIST "%PYTHON_PATH%" ( | |
SET SCRIPT=%PYTHON_PATH%\%RUN_DOTPY% | |
) ELSE ( | |
IF EXIST %PYTHON% SET SCRIPT=%PYTHON%\%RUN_DOTPY% | |
) | |
) | |
IF NOT "" == "%SCRIPT%" ( | |
%SCRIPT% | |
pause | |
) ELSE ( | |
echo. | |
echo Python.exe is not in the path! | |
pause | |
) | |
:end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment