#include <WinAPIEx.au3>
Local $aSize[3] = [16, 32, 48], $aIcon[3], $sIcon = @ScriptDir & '\File.exe', $aRes, $iCount
If Not FileExists($sIcon) Then Exit 13
$aRes = DllCall('shell32.dll', 'uint', 'ExtractIconExW', 'wstr', $sIcon, 'int', -1, 'ptr', 0, 'ptr', 0, 'uint', 1)
If (@error) Or (Not $aRes[0]) Then Exit 13
$iCount = $aRes[0]
For $i = 0 To $iCount - 1
For $j = 0 To 2
$aIcon[$j] = _WinAPI_ShellExtractIcon($sIcon, $i, $aSize[$j], $aSize[$j])
If @error Then ExitLoop
Next
If Not @error Then _WinAPI_SaveHICONToFile(@ScriptDir & '\' & $i + 1 & '.ico', $aIcon)
For $j = 0 To 2
If $aIcon[$j] Then _WinAPI_DestroyIcon($aIcon[$j])
Next
Next