Command Prompt

Discussion in 'Python' started by EAS, May 21, 2004.

  1. EAS

    EAS Guest

    Is there any way of using Python to open a command prompt?
    EAS, May 21, 2004
    #1
    1. Advertising

  2. EAS

    Lee Harr Guest

    On 2004-05-21, EAS <> wrote:
    > Is there any way of using Python to open a command prompt?
    >
    >


    Almost certainly going to depend on your system.
    I would use ...


    import os
    os.system('xterm &')
    Lee Harr, May 21, 2004
    #2
    1. Advertising

  3. EAS

    Terry Reedy Guest

    "EAS" <> wrote in message
    news:Cnurc.5$hi6.3519@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).

    Terry J. Reedy
    Terry Reedy, May 21, 2004
    #3
  4. EAS

    EAS Guest

    Depend on the operating system or the computer? The two OS I use are Windows
    XP Pro and
    Windows NT 2000 Pro.
    EAS, May 21, 2004
    #4
  5. EAS

    Peter Hansen Guest

    Terry Reedy wrote:

    > "EAS" <> wrote in message
    > news:Cnurc.5$hi6.3519@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
    Peter Hansen, May 22, 2004
    #5
  6. EAS

    EAS Guest

    It works! Thanks.
    EAS, May 22, 2004
    #6
  7. Peter Hansen wrote:
    > 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.


    There's a huge difference between the two. cmd.exe is a 32-bit console
    application, and command.com is a 16-bit DOS application. You definitely
    want cmd.exe on the NT versions of Windows (NT, 2000, XP).

    -Mike
    Michael Geary, May 22, 2004
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kenneth Brun Nielsen

    Synopsys Design Analyzer in command prompt

    Kenneth Brun Nielsen, May 9, 2005, in forum: VHDL
    Replies:
    6
    Views:
    2,927
    Kenneth Brun Nielsen
    May 9, 2005
  2. chrisdude911
    Replies:
    10
    Views:
    135,334
    srk289
    Mar 10, 2009
  3. gaurav kashyap
    Replies:
    2
    Views:
    607
    gaurav kashyap
    Oct 30, 2008
  4. gaurav kashyap
    Replies:
    3
    Views:
    673
    gaurav kashyap
    Oct 31, 2008
  5. Mel
    Replies:
    10
    Views:
    3,097
    Sailaja Appi
    Feb 13, 2009
Loading...

Share This Page