in reply to Re: Set Icon
in thread Set Icon

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.

Replies are listed 'Best First'.
Re^3: Set Icon
by Bod (Parson) on Dec 24, 2020 at 00:14 UTC

    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.

        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.

        An existing console window does have some limitations on what is permitted. So your guess is very plausible. I can't recall exactly what the limitations are but changing the icon could very well be one.

Re^3: Set Icon
by PilotinControl (Pilgrim) on Dec 24, 2020 at 03:37 UTC

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