How to store output of a python program in command prompt?
<p>I'm passing run time variable from command prompt to python to execute there (im=n python). Now I want to store the result of python program and use those results back into command prompt. Sample is as follows</p>

<pre><code>set input=
set /P input=Enter Layer Name:%=%
C:\Python27\python.exe F:\xampp\htdocs\flood_publish\projection_raster.py %input%
</code></pre>

<p>I'm passing user input string to python program from command prompt as above.
How use the result of python program back into command prompt</p>

<p>Assuming its a bash script from where you are calling the python function, it should be done like:</p>

<pre><code>function callPython()
{
    local pythonResult=&lt;code for calling python&gt;
    echo $pythonResult
}

local pythonReturnOutput = $(callPython)
</code></pre>

<p>and you can now use pythonReturnOutput.</p>

<p>This answer may be incorrect, if you are not using bash, shell script. However, I would highly recommend to have a script in place, if its not already.</p>

python shell cmd runtime parameter-passing