Batch commands on Windows
Harry George
harry.g.george at boeing.com
Fri Jan 23 04:42:01 EST 2004
"Dave Brueck" <dave at pythonapocrypha.com> writes:
> Moosebumps wrote:
> > So, after reading some messages about os.system, and looking at the popen
> > stuff and trying it a bit, I still have not found a way to keep a command
> > window open for several commands (on Windows 2000/XP), while seeing the
> > normal output in a command window. All I want to do is do what a batch file
> > does, but I want to actually have functions and associative arrays and all
> > the other niceties of python.
>
> Can you give an example of what you mean, in Perl as well as what you hoped
> would work in Python? I couldn't quite understand what it is that you're trying
> to do.
>
> > What's the deal with that? I thought Python started out as a scripting
> > language. And that seems like the most basic thing that a scripting
> > language should do.
>
> Dunno, although MS-DOS shell scripting is certainly a small subset of scripting
> in general. Maybe with a concrete example somebody will be able to give you a
> hand.
>
> -Dave
>
>
I wonder if this is miscommunication over "script" vs "shell window".
This confused me when trying python scripts in MS Windows after using
then in *NIX.
Quite often a script will output to stdout. In *NIX the script is
usually run from a shell, in which case the output goes to the shell
and you can see it. But in Windows there is no automatic shell -- you
have to explicitly tell the script where to put the output. Otherwise
a DOS shell wakes up long enough to complain and then goes away. (At
least that's what I think is happening.)
An alternative is to install cygwin and run scripts from the bash
shell -- you will see output. Even better, install emacs too, then
run scripts from inside am emacs bash shell buffer -- you can then
search, edit, print, etc the output.
Another alternative is to redirect your script output to a file, and
then examine it via notepad or (if linefeeds are screwed up) wordpad.
--
harry.g.george at boeing.com
6-6M31 Knowledge Management
Phone: (425) 342-5601
More information about the Python-list
mailing list