Command Prompt

Peter Hansen peter at engcorp.com
Fri May 21 19:20:08 EDT 2004


Terry Reedy wrote:

> "EAS" <eriksp at attbi.nospam.com> wrote in message
> news:Cnurc.5$hi6.3519 at attbi_s53...
> 
>>Is there any way of using Python to open a command prompt?
> 
> 
> You may need to be more specific.  On various versions of Windows, in batch
> or interactive mode, os.system('command.com') might or might not do what
> you want.  On Win XP, interactive mode, one is already in a command window
> and the above gives a command prompt 'C:/Python...' in the same window,
> where one can do dir, cd, type, etc, and finally exit to return to Python
> and its prompt (again in the same window).

Minor issue: on Win XP, there is a "command" and a "cmd".  Here's
the visible difference between the two:

c:\>cmd
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

c:\>command
Microsoft(R) Windows DOS
(C)Copyright Microsoft Corp 1990-2001.

Presumably there are other, more significant differences as well.

Probably advisable to use "cmd" under WinXP, but that's just a hunch.

-Peter



More information about the Python-list mailing list