Created
January 15, 2022 23:10
-
-
Save otonii/4fdba541c865513e14637b99c9375928 to your computer and use it in GitHub Desktop.
Extract Icon from .exe with PowerShell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ExtractIcon { | |
Param ( | |
[Parameter(Mandatory=$true)] | |
[string]$folder | |
) | |
[System.Reflection.Assembly]::LoadWithPartialName('System.Drawing') | Out-Null | |
md $folder -ea 0 | Out-Null | |
dir $folder *.exe -ea 0 -rec | | |
ForEach-Object { | |
$baseName = [System.IO.Path]::GetFileNameWithoutExtension($_.FullName) | |
Write-Progress "Extracting Icon" $baseName | |
[System.Drawing.Icon]::ExtractAssociatedIcon($_.FullName).ToBitmap().Save("$folder\$BaseName.ico") | |
} | |
} | |
ExtractIcon -folder "C:\Path" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment