How to run commands in command line from a script
darkpaladin79 at hotmail.com
Fri Jul 1 05:43:00 CEST 2005
Alright well I'm quite a noob and when I run a simple command to change the
current directory, nothing happens. I made a little test script to show it:
cwd = os.getcwd()
os.system('cd = C:\Program Files')
then the result:
The cd never changed. . . Can somebody explain this? I think I need to add
something simple, i didnt quite get the example ' os.system('./some
>From: Robert Kern <rkern at ucsd.edu>
>To: python-list at python.org
>Subject: Re: How to run commands in command line from a script
>Date: Thu, 30 Jun 2005 20:01:29 -0700
>Ivan Shevanski wrote:
> > I know there is an easy way to do this, and I just can not remember. I
> > already searched where I thought the module would be. . . I just want to
> > some name specific commands. Is this easily possible?
>Quick and dirty:
> import os
> os.system('./some --command')
>More robust: Use the subprocess module.
>rkern at ucsd.edu
>"In the fields of hell where the grass grows high
> Are the graves of dreams allowed to die."
> -- Richard Harter
Dont just search. Find. Check out the new MSN Search!
More information about the Python-list