Query: Pass variable to DOS bat file

Aahz Maruch aahz at netcom.com
Tue Sep 14 00:04:00 EDT 1999


In article <37ddbf00.23343510 at nntp.ix.netcom.com>,
Milas Omdalen <omdalen at ix.netcom.com> wrote:
>
>Seeking to implement a rather long menu of zipped file choices. The
>basic dos bat file does not handle large menu choices very well. But I
>don't see a way to use the zip program in Python.
>
>Can I call dos programs from within Python script?

import os
os.system('unzip foo')

>Can I use a Python unzip program?

That might be better; take a look at the gzip module.  I think there's
also a tar module somewhere.  Unfortunately, this is not compatible with
pkzip.

>Can I pass the menu choice chosen in the Python script to the dos bat
>file?

Python:
os.system ( 'batch foo bar' )

Batch:
echo %1
echo %2

>I see that I can call the Python script file from my bat file. Maybe
>use Global variables? I thought of saving the variable in a file, an
>awfully roundabout implementation.

This is probably not a good idea.
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>      http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6  (if you want to know, do some research)




More information about the Python-list mailing list