[Tutor] Opening a cmd.exe
Mark Tolonen
metolone+gmane at gmail.com
Sun Mar 22 17:22:12 CET 2009
"Tim Golden" <mail at timgolden.me.uk> wrote in message
news:49C65068.2080709 at timgolden.me.uk...
> Tim Golden wrote:
>> Alan Gauld wrote:
>>> "Sigga Sig" <sigridurs07 at ru.is> wrote
>>>
>>>> I am writing a code that is supoesed to act as routers and i need to
>>>> open a
>>>> different cmd window for each one of them with it's name and so on. I
>>>> do not
>>>> know how to implement in mi Python cod a sentece that opens such a cmd.
>>>>
>>>> I know how to open a cmd.exe bud not with specific attributes that are
>>>> needed.
>>>
Does this do what you want? It creates a new cmd window titled "Dir", then
executes some commands. If you want the window to stay open after executing
the commands, use /k instead of /c. 'cmd /?' gives other switches you might
want. The escaping(^) of the ampersands(&) is required or the commands will
run in the current console not the new one.
import os
os.system('start cmd /c title Dir ^&^& dir ^&^& pause')
-Mark
More information about the Tutor
mailing list