in reply to Set Icon

Win32 Console code below:
sub icon { my $sIcon = Win32::Console::SetIcon("logo.gif"); }
Thanks in advance!

According to the Win32::Console documentation, a *.ico file is required not a *.gif file and the syntax is:

$CONSOLE->SetIcon("C:/My/Path/To/Custom.ico");
so I would try something like....
my $CONSOLE = Win32::Console->new; $CONSOLE->SetIcon('C:/myIcon.ico');
or...
Win32::Console->SetIcon('C:/myIcon.ico');
These are untested but might provide you with some some progress!

Replies are listed 'Best First'.
Re^2: Set Icon
by pryrt (Abbot) on Dec 24, 2020 at 00:06 UTC
    Confirmation: start perl -MWin32::Console -e "my $C=Win32::Console->new(); $C->SetIcon('pp.ico'); $C->Title('Hello World'); sleep 10" worked for me. However, if I tried to run that without the start, the title would change but the icon would not. But that experiment also showed that the icon file can be relative (mine was in the current directory) rather than having to specify the whole path.

      Thanks pryrt - I couldn't carry out that test as the laptop I am currently using doesn't have Perl installed

      Perhaps start was needed just to allow a relative directory for the icon file.

        Perhaps start was needed just to allow a relative directory for the icon file.

        Nope, even if I have the full path to the icon file, I still needed the start.

        My guess was actually because I was running from an existing cmd.exe console, so maybe there are some things you're not allowed to change on that window.

        If I run the similar command from the Win+R Run menu, without the start and with full path to the icon, it also works -- again, it's creating a fresh console window rather than relying on a pre-existing window.

        If I put it into a batch file, which I run perl (without the start prefix) from either the cmd.exe window or from double-clicking via explorer, then it does change the icon for either. And when the batch file is done, the window continues to use the new icon. Interesting.

        Anyway, hope this helps the OP.

      I can confirm with pryrt that the test above worked just as he described it would.