1

I need help form you guys,I want to know ,How can I get description of Desktop icon using batch code? Thanks sorry for my bad English

Matar Mudi
  • 37
  • 7

2 Answers2

0

not possible with pure batch.But you can try tooltipinfo.bat or shortcutjs.bat . They are hybrid scripts that combine wsh/jscript/batch and should be saved with .bat extension. Here's how you can use them:

tooltipinfo.bat "C:\Users\my\Desktop\Git Shell.lnk"

or

shortcutjs.bat -examine "C:\Users\my\Desktop\Git Shell.lnk"
npocmaka
  • 55,367
  • 18
  • 148
  • 187
0

You could invoke a PowerShell command to retrieve the info. In a .bat script or in a cmd console,

powershell "(new-object -COM wscript.shell).CreateShortcut('Word 2013.lnk').Description"

... would simply output the description stored in the "Word 2013" shortcut's comment field to the console. (Don't worry: the CreateShortcut method doesn't overwrite your shortcut. Think of it as creating space in memory for the shortcut object's retrieval.)

If you want to capture the description to a variable, use a for /f loop.

@echo off
setlocal

set "lnk=Word 2013.lnk"

for /f "delims=" %%I in (
    'powershell "(new-object -COM wscript.shell).CreateShortcut('%lnk%').Description"'
) do set "description=%%~I"

echo %description%

(Credit should go to Jason Archer for the idea.)

Community
  • 1
  • 1
rojo
  • 24,000
  • 5
  • 55
  • 101