|
|
本帖最后由 redyear2026 于 2026-7-27 23:35 编辑
用 bat+powershell 脚本获取 c:\Windows\System32\shell32.dll 或 c:\Windows\System32\imageres.dll 包含的图标索引号,代码预设路径是前者,若改为后者,可在代码第4行自行替换...
test.bat- <# ::
- @echo off &powershell -nop -c "iex(${%~f0}|out-string)" &pause&exit/b
- #>
- $n=0; $maxP=260; $lib='c:\Windows\System32\shell32.dll'
- $path=[Runtime.InteropServices.Marshal]::StringToBSTR($lib)
- $buf=New-Object Text.StringBuilder($lib, $maxP)
- Add-Type '
- using System; using System.Runtime.InteropServices;
- public class p {
- [DllImport("shell32.dll", EntryPoint="PickIconDlg", CharSet=CharSet.Unicode)]
- public static extern int picker(IntPtr h, [MarshalAs(UnmanagedType.LPWStr)] string path, uint maxPath, ref int index); } '
- $r=[p]::picker([IntPtr]::Zero, $buf, $maxP, [ref]$n)
- if ($r -ne 1) { exit }
- "图标库文件: $($buf.ToString())`n图标索引号: $n"; exit
复制代码
|
|