< Back

Get-IconFromFile

Tue Jan 14, 2020 3:48 am

NAME Get-IconFromFile



SYNOPSIS

Gets icons from .exe, .dll, and icon files





SYNTAX

Get-IconFromFile [-Path] <String[]> [[-Index] <Int32>] [-LargeIcon] [<CommonParameters>]





DESCRIPTION

Get-IconFromFile retrieves icons from .exe, .dll, and icon files. If the file contains more than one, you can

specify the index of the icon with the Index parameter.



By default the command retrieves the small version of the icons, but it can return the large version, if they

exist, by using the LargeIcon switch.





PARAMETERS

-Path <String[]>

The path to the file containing the icon to retrieve.



Required? true

Position? 1

Default value

Accept pipeline input? true (ByValue, ByPropertyName)

Accept wildcard characters? false



-Index <Int32>

The index of the icon if the file contains more than one.



Required? false

Position? 2

Default value 0

Accept pipeline input? false

Accept wildcard characters? false



-LargeIcon [<SwitchParameter>]

Specifies that the large version should be retrieved.



Required? false

Position? named

Default value False

Accept pipeline input? false

Accept wildcard characters? false



<CommonParameters>

This cmdlet supports the common parameters: Verbose, Debug,

ErrorAction, ErrorVariable, WarningAction, WarningVariable,

OutBuffer, PipelineVariable, and OutVariable. For more information, see

about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).



INPUTS

System.String



Get-IconFromFile accepts string objects of file paths to the Path parameter binding to the Path property.





OUTPUTS

System.Drawing.Icon



Get-IconFromFile outputs a System.Drawing.Icon object representing the icon.





NOTES





The basis for this command came from a post by Kazun on the forum

http://social.technet.microsoft.com/For ... d619381a27



-------------------------- EXAMPLE 1 --------------------------



PS C:>Get-IconFromFile -Path setupapi.dll -Index 21



This command will retrieve the small icon located in the setupapi.dll file located at the 21st index.









-------------------------- EXAMPLE 2 --------------------------



PS C:>Get-IconFromFile -Path setupapi.dll -Index 21 -LargeIcon



This command will retrieve the large icon located in the setupapi.dll file located at the 21st index.











RELATED LINKS