[Tutor] Cmd Advice

Walter Prins wprins at gmail.com
Sun Feb 5 17:34:47 CET 2012

Hello Dave,

On 5 February 2012 15:26, Dave Hanson <dave at hansonforensics.co.uk> wrote:
> I can force a dos window to open by using a bat or python program.

OK, so the command prompt issue is really a red herring then from what
I can tell.  Work around the standard limitations of your desktop in
whatever way suits you (providing you're not going to get yourself
into trouble by doing so etc).  As long as you can get to a command
prompt you can then set up the program to work the same way as on
Unix, with a bit of jiggery pokery.

> What I'm
> trying to get around is not being able to interact with the program using
> [options] like -l for list for example.

OK, so your real issue involved command line arguments it seems.  What
I'd do is write a wrapper batch file for your Python program named
"t.bat", and place it in a location that's on your search path, or add
it to the search path if you like (perhaps put it alongside t.py and
then put that location on the system PATH.)

t.bat should contain something like this (adjust paths as required obviously):

c:\Python27\python.exe c:\src\t\t.py %1 %2 %3 %4 %5 %6 %7 %8 %9

This command line will obviously pass the first 9 command line
argument strings given to the batch file on to the Python program.

What this does is to allow you to run the command like you do on Unix, e.g:

t -f 5

... which in turn should will find and run t.bat with the command line
arguments "-5 5" which then pass them on to the Python program etc.



More information about the Tutor mailing list