[Tutor] Opening a cmd.exe

Tim Golden mail at timgolden.me.uk
Sun Mar 22 15:49:02 CET 2009


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.
> 
> Neither do I. You can use shortcuts and set the name of the shortcut
> and that will show up on the window title.
> 
> There are probably ways to do it using the Win32 API too, but you would
> need to get the Window Handle using FindWindow(). And I'm still not sure
> which API call would set the title. I'd probably just create a set of
> shortfcuts on a folder and execute those.

You can do it with the win32console functions from pywin32:

  win32console.SetConsoleTitle (u"blahblah")

TJG


More information about the Tutor mailing list