getting the “friendly” name for window startmenu items/shortcut files

强颜欢笑 提交于 2019-12-04 05:25:06

问题


This is curious, some startmenu items seems to resolve to a "friendly" name that's not contained in the actual .lnk file. For example:

"c:\ProgramData\Microsoft\Windows\Start Menu\Programs\Accessories\System Tools\dfrgui.lnk" is displayed in explorer as "Disk Defragmenter", the actual shortcut file doesn't contain the real name either but links to the exe "C:\Windows\system32\dfrgui.exe""

Is this a Win32 API thing or is there a simpler way to get the "friendly" name of a file/start menu item?


回答1:


There's a hidden file in that folder named desktop.ini. This is the content on my machine:

[.ShellClassInfo]
LocalizedResourceName=@%SystemRoot%\system32\shell32.dll,-21788
[LocalizedFileNames]
System Information.lnk=@%systemroot%\system32\msinfo32.exe,-100
Resource Monitor.lnk=@%SystemRoot%\system32\wdc.dll,-10030
dfrgui.lnk=@%systemroot%\system32\dfrgui.exe,-103
Task Scheduler.lnk=@%SystemRoot%\system32\miguiresource.dll,-201
System Restore.lnk=@%systemroot%\system32\rstrui.exe,-100
Disk Cleanup.lnk=@%SystemRoot%\system32\shell32.dll,-22026
Character Map.lnk=@%SystemRoot%\system32\shell32.dll,-22021
Windows Easy Transfer.lnk=@%windir%\system32\migwiz\wet.dll,-588
Windows Easy Transfer Reports.lnk=@%windir%\system32\migwiz\wet.dll,-591

This is the relevant line:

dfrgui.lnk=@%systemroot%\system32\dfrgui.exe,-103

The -103 value indicates the string is read from string resource #103 in dfrgui.exe. In Visual Studio, I used File + Open + File, selecting c:\windows\system32\dfrgui.exe. Opened "String table" and double-clicked it:

This may well be different on your machine, depending on where you live. What I showed is for the English version of Win7.



来源:https://stackoverflow.com/questions/4358580/getting-the-friendly-name-for-window-startmenu-items-shortcut-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!