Extract an EXE Icon to PNG Using PowerShell (No Installs Needed)
- Josue Valentin
- Oct 8
- 1 min read
If you want to grab the icon from a Windows application without installing any third-party software, PowerShell can handle it natively using built-in .NET libraries. This method is ideal for creating documentation, shortcuts, or deployment visuals when you need the actual program icon as a PNG file.
What This Script Does
The script lets you browse for any .exe file, extracts its main application icon, and saves it as a transparent .png file in the same folder. Everything runs locally with no external dependencies.
The Script
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
Add-Type -AssemblyName PresentationCore
# Open file browser to pick an EXE
$dialog = New-Object System.Windows.Forms.OpenFileDialog
$dialog.Filter = "Executable Files (*.exe)|*.exe"
$dialog.Title = "Select an EXE to extract the icon from"
if ($dialog.ShowDialog() -eq [System.Windows.Forms.DialogResult]::OK) {
$exe = $dialog.FileName
$out = [IO.Path]::ChangeExtension($exe, ".png")
$icon = [System.Drawing.Icon]::ExtractAssociatedIcon($exe)
$bitmap = $icon.ToBitmap()
$fs = New-Object IO.FileStream($out, [IO.FileMode]::Create)
$bitmap.Save($fs, [System.Drawing.Imaging.ImageFormat]::Png)
$fs.Close()
Write-Host "Saved PNG icon to $out"
} else {
Write-Host "No file selected."
}

