Created
January 29, 2017 23:21
-
-
Save zfwf/c8375e833daae68d2764dcb2e36fcb70 to your computer and use it in GitHub Desktop.
polyglot to run python in windows batch
This file contains hidden or 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
@SETLOCAL ENABLEDELAYEDEXPANSION & CALL "%~f0" & (IF NOT ERRORLEVEL 1 (python -x "%~f0" %*) ELSE (ECHO No python environment found on path)) & PAUSE & EXIT /B !ERRORLEVEL! | |
#%0 is the command itself. So %~f0 expands to the full path of the batch file. %* stands for all command line parameters except %0. | |
#do something in python |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment