Returning a python value to the calling bat file

Duncan Booth duncan at NOSPAMrcp.co.uk
Thu Nov 8 04:16:17 EST 2001


"Jeff Schroeder" <jeffs at construx.com> wrote in
news:zTdG7.174$ZE3.29961 at paloalto-snr1.gtei.net: 

> I have a NT Shell bat file that calls a python script to do some
> processing, then want that python to return the value to the calling
> bat file.  How do I do that?
> 
> Thanks in advance,
> Jeff
> 
> 

sys.exit(n) sets errorlevel to n, where n is an integer.

If you want to return strings then read up on the /F option of the FOR 
command or (better) convert the rest of the batch file into Python as well.

-- 
Duncan Booth                                             duncan at rcp.co.uk
int month(char *p){return(124864/((p[0]+p[1]-p[2]&0x1f)+1)%12)["\5\x8\3"
"\6\7\xb\1\x9\xa\2\0\4"];} // Who said my code was obscure?



More information about the Python-list mailing list