Search code examples
c#windowswinapistartmenu

getting the "friendly" name for window startmenu items/shortcut files


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?


Solution

  • 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:

    Shows string table content

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