Re: How to run commands in command line from a script

Discussion in 'Python' started by Ivan Shevanski, Jul 1, 2005.

  1. Well, the thing is that I was just using changing directories as an example
    for running a name specific command, is the <long winded reply here> the
    only way to run name specific commands? An example would be (what I am
    actually trying to do) run the simply command
    mame s1945
    in the command line. MAME is, for those of you that care, the multaple
    arcade machine emulator and the command runs the classic game strikers 1945.
    I'm just trying to automate the tedious process of running it through the
    command line. By the way, thanks to everyone who responded I'm really
    getting along here.

    Thanks,
    -Ivan




    > >
    > > Generally, the only way to use an application (i.e. a program like the
    > > Python interpreter, or your own .exe) to change the working folder is to
    > > have your script executed from within a batch file, write out a new
    > > batch file in your script, and then have the calling batch file execute
    > > that script if it exists.

    >
    >And, after that long-winded reply, here's another option, if you're just
    >trying to change the directory _within_ your app but don't care if the
    >change persists:
    >
    >import os
    >os.chdir(r'c:\Program Files')
    >
    >-Peter
    >--


    _________________________________________________________________
    Don’t just search. Find. Check out the new MSN Search!
    http://search.msn.click-url.com/go/onm00200636ave/direct/01/
    Ivan Shevanski, Jul 1, 2005
    #1
    1. Advertising

  2. Ivan Shevanski

    Peter Hansen Guest

    Ivan Shevanski wrote:
    > Well, the thing is that I was just using changing directories as an
    > example for running a name specific command, is the <long winded reply
    > here> the only way to run name specific commands? An example would be
    > (what I am actually trying to do) run the simply command
    > mame s1945
    > in the command line. MAME is, for those of you that care, the multaple
    > arcade machine emulator and the command runs the classic game strikers
    > 1945. I'm just trying to automate the tedious process of running it
    > through the command line. By the way, thanks to everyone who responded
    > I'm really getting along here.


    So basically "os.system" would have done exactly what you wanted if
    you'd tried it on "mame" instead of using "cd", for reasons we've now
    covered. :)

    -Peter
    Peter Hansen, Jul 1, 2005
    #2
    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. Lucas Cowald
    Replies:
    4
    Views:
    1,036
    Tohid
    Oct 23, 2003
  2. Ivan Shevanski
    Replies:
    3
    Views:
    385
    Mike Meyer
    Jul 1, 2005
  3. Replies:
    1
    Views:
    324
    Larry Bates
    Dec 14, 2006
  4. Sonu
    Replies:
    2
    Views:
    361
    Alex Popescu
    Aug 5, 2007
  5. Replies:
    12
    Views:
    184
    Tintin
    Jul 30, 2005
Loading...

Share This Page