Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Changing the title of the command window on which the perl exe is run

by furry_marmot (Pilgrim)
on Apr 30, 2011 at 20:29 UTC ( #902253=note: print w/ replies, xml ) Need Help??


in reply to Changing the title of the command window on which the perl exe is run

Wow. The snarkiness is flying today! And yet no one has the answer! Kuh-ching!

First, an explanation of why your approach doesn't work. When you run system from Perl, you are running a new shell, which is to say a new copy of CMD.exe, which has its own environment. You type title <something> and it works, but as soon as the new shell exits, you're back in the parent shell, which never had its title changed. You have to do it from inside, via the Win32 API.

use Win32::Console; my $CONSOLE=Win32::Console->new; $CONSOLE->Title('This is a new title - Huzzah!');

That will change the title for the duration of your script. When the script ends, the title will revert to what it was before you ran the script. You can change the title as much as you want.

Cheers!

--marmot


Comment on Re: Changing the title of the command window on which the perl exe is run
Select or Download Code
Re^2: Changing the title of the command window on which the perl exe is run
by Anonymous Monk on May 01, 2011 at 04:26 UTC
    using system 'title', 'the title;' will work form within your program same as using Win32::Console, for the duration of the program

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://902253]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2014-08-22 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best computer themed movie is:











    Results (153 votes), past polls