[python-win32] setting title bar of cmd.exe

Tim Golden mail at timgolden.me.uk
Fri Jul 29 23:18:08 CEST 2011


On 29/07/2011 22:15, Ethan Furman wrote:
> Thomas Heller wrote:
>> Am 29.07.2011 19:19, schrieb Thomas Heller:
>>> Am 29.07.2011 19:15, schrieb Ethan Furman:
>>>> When running commands from cmd the title bar will update to relect the
>>>> currently running command. Is there a way to have python scripts run
>>>> from cmd.exe to update the cmd title bar?
>>>>
>>>> ~Ethan~
>>>
>>> from ctypes import windll
>>>
>>> windll.kernel32.SetConsoleTitleA("foobar")
>>> -or-
>>> windll.kernel32.SetConsoleTitleA(u"spam")
>>
>> Sorry, the last one should read (note the 'W' instead of 'A'):
>>
>> windll.kernel32.SetConsoleTitleW(u"spam")
>
> Thank you very much!
>
> Just out of curiosity, is there a similar command using win32?

Assuming you meant: using the pywin32 extensions, then check out
the win32console module for all your console needs

:o)

TJG



More information about the python-win32 mailing list