Can a batch file execute commands within a python shell? -


can use batch file start python shell , execute commands? know that

python 

will start python shell, batch file containing

python 1+1 

will first run python, , when quit python attempt run 1+1. not execute commands within python shell.

after little searching around, managed find this website has method this. see on website, need is:

@setlocal enabledelayedexpansion && python -x "%~f0" %* & exit /b !errorlevel!  #start python code here  print "hello world" 

this didn't work me, thought might help.

i haven't been able find other source says it's possible.

just thought of else haven't tested. combined bear's answer , mine.

@for /f "skip=1 delims=" %i in (%0) @python -c "%i" #start python here. 

however, other method should used.


Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -