Last active
August 26, 2016 06:52
-
-
Save abakum/8d86b0a69e402c128b04bb81749553d1 to your computer and use it in GitHub Desktop.
Helpers for start python
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 args= | |
:loop | |
if "%~1"=="" goto run | |
call :repl %1 | |
set args=%args% "%s%" | |
shift | |
goto loop | |
:run | |
set bit=32 | |
if exist "%SystemRoot%\SysWOW64" set bit=64 | |
c:\msys%bit%\mingw%bit% winpty python -i %args% | |
exit | |
:repl | |
set s=%~1 | |
set s=%s:\=/% | |
if "%s:~1,1%"==":" set s=/%s:~0,1%%s:~2% |
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 bit=32 | |
if exist "%SystemRoot%\SysWOW64" set bit=64 | |
set msys=c:\msys%bit% | |
set mintty="%msys%\usr\bin\mintty.exe" | |
set py="%SystemRoot%\py.exe" | |
if exist %py% goto run | |
set py="%msys%\mingw%bit%\bin\python.exe" | |
:run | |
set winpty="%msys%\usr\bin\winpty.exe" | |
if not exist %winpty% set winpty= | |
%mintty% -w max -o Locale=ru_RU -o Charset=CP1251 -e %winpty% %py% -i %* |
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 bit=32 | |
if exist "%SystemRoot%\SysWOW64" set bit=64 | |
set msys=c:\msys%bit% | |
set mintty="%msys%\usr\bin\mintty.exe" | |
set py="%SystemRoot%\py.exe" | |
if exist %py% goto run | |
set py="%msys%\mingw%bit%\bin\python.exe" | |
:run | |
set winpty="%msys%\usr\bin\winpty.exe" | |
if not exist %winpty% set winpty= | |
%mintty% -w max -o Locale=ru_RU -o Charset=UTF-8 -e %winpty% %py% -i %* |
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 args= | |
:loop | |
if "%~1"=="" goto run | |
call :repl %1 | |
set args=%args% "%s%" | |
shift | |
goto loop | |
:run | |
set bit=32 | |
if exist "%SystemRoot%\SysWOW64" set bit=64 | |
set msys=c:\msys%bit%\usr\bin | |
set mintty="%msys%\mintty.exe" | |
set wslbridge="%msys%\wslbridge.exe" | |
%mintty% -w max -e %wslbridge% python -i %args% | |
exit | |
:repl | |
set s=%~1 | |
rem -------subst----------- | |
set s=%s:y:=c:\YandexDisk% | |
set s=%s:z:=c:\Google Drive% | |
rem ----------------------- | |
set s=%s:\=/% | |
if not "%s:~1,1%"==":" goto noDrv | |
set d=%s:~0,1% | |
set d=%d:A=a% | |
set d=%d:B=b% | |
set d=%d:C=c% | |
set d=%d:D=d% | |
set d=%d:E=e% | |
set d=%d:F=f% | |
set d=%d:G=g% | |
set d=%d:H=h% | |
set d=%d:I=i% | |
set d=%d:J=j% | |
set d=%d:K=k% | |
set d=%d:L=l% | |
set d=%d:M=m% | |
set d=%d:N=n% | |
set d=%d:O=o% | |
set d=%d:P=p% | |
set d=%d:Q=q% | |
set d=%d:R=r% | |
set d=%d:S=s% | |
set d=%d:T=t% | |
set d=%d:U=u% | |
set d=%d:V=v% | |
set d=%d:W=w% | |
set d=%d:X=z% | |
set d=%d:Y=y% | |
set d=%d:Z=z% | |
:noDrv | |
set s=/mnt/%d%%s:~2% |
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 | |
chcp 1251>nul | |
set py=%windir%\py.exe | |
if exist %py% goto run | |
set bit=32 | |
if exist "%SystemRoot%\SysWOW64" set bit=64 | |
set py=c:\msys%bit%\mingw%bit%\bin\python.exe | |
:run | |
%py% -i %* |
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 args= | |
:loop | |
if "%~1"=="" goto run | |
call :repl %1 | |
set args=%args% "%s%" | |
shift | |
goto loop | |
:run | |
bash -c 'python -i %args%' | |
exit | |
:repl | |
set s=%~1 | |
rem -------subst----------- | |
set s=%s:y:=c:\YandexDisk% | |
set s=%s:z:=c:\Google Drive% | |
rem ----------------------- | |
set s=%s:\=/% | |
if not "%s:~1,1%"==":" goto noDrv | |
set d=%s:~0,1% | |
set d=%d:A=a% | |
set d=%d:B=b% | |
set d=%d:C=c% | |
set d=%d:D=d% | |
set d=%d:E=e% | |
set d=%d:F=f% | |
set d=%d:G=g% | |
set d=%d:H=h% | |
set d=%d:I=i% | |
set d=%d:J=j% | |
set d=%d:K=k% | |
set d=%d:L=l% | |
set d=%d:M=m% | |
set d=%d:N=n% | |
set d=%d:O=o% | |
set d=%d:P=p% | |
set d=%d:Q=q% | |
set d=%d:R=r% | |
set d=%d:S=s% | |
set d=%d:T=t% | |
set d=%d:U=u% | |
set d=%d:V=v% | |
set d=%d:W=w% | |
set d=%d:X=z% | |
set d=%d:Y=y% | |
set d=%d:Z=z% | |
:noDrv | |
set s=/mnt/%d%%s:~2% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For WSL over minTTY copy https://github.com/rprichard/wslbridge/releases to c:\msys32\usr\bin or c:\msys64\usr\bin
then use https://gist.github.com/abakum/8d86b0a69e402c128b04bb81749553d1#file-minttyw-py-bat