Program icons

Jun 8, 2012 at 4:44 PM

First, thank you for this great app. It will be really handy for my script as I am working to deploy it at customer sites and expect the exe will be more readily accepted.

My question to you is; is there a way to use the script to apply a program icon to the executable? While it is not essential, it would certainly make the compiled app more attractive and professional looking.

If anyone happens to know how to reference an icon from within an exe file from PowerShell that would be handy knowledge too!

I'm not too bad with PowerShell but the P2EXE is quite far above my skill level.


Aug 24, 2012 at 3:00 PM


I have same problem. So i modify ps2exe.ps1 (line 58) to resolve it :
$cp.CompilerOptions = "/platform:$($platform) /win32icon:""c:\myicon.ico"" " 

Best regards

Mar 17, 2015 at 5:51 PM

It's not necessary to modify the compiler as Olivier stated, although it probably does get the job done.

The simplest way is to put your .ico file in the same directory as the exe you're compiling, then using the built in parameter. (-iconFile loop.ico)

Here's an example of what did the trick for me, in compiling an exe with an icon file.

PS C:\pshell\ps2exe> .\ps2exe.ps1 -inputFile c:\pshell\ps2exe\SDPCResolver.ps1 c:\pshell\ps2exe\SDPCResolver.exe -iconFile loop.ico -noconsole -x64

The above is correct, didn't even need to add file path for loop.ico, simply made sure it was in same directory.