I have used the following command to get the shortcut (.lnk) file details in user's desktop using WMIC.
wmic datafile where "path="\users\%username%\desktop\" and extension='lnk'" get /value
It giving the output as mentioned below;
AccessMask=18809343
Archive=TRUE
Caption=c:\users\jarilv\desktop\windirstat.lnk
Compressed=FALSE
CompressionMethod=
CreationClassName=CIM_LogicalFile
CreationDate=20160512120434.985705+330
CSCreationClassName=Win32_ComputerSystem
CSName=SA-DOIT-CL1
Description=c:\users\jarilv\desktop\windirstat.lnk
Drive=c:
EightDotThreeFileName=c:\users\jarilv\desktop\windir~1.lnk
Encrypted=FALSE
EncryptionMethod=
Extension=lnk
FileName=WinDirStat
FileSize=1033
FileType=Shortcut
FSCreationClassName=Win32_FileSystem
FSName=NTFS
Hidden=FALSE
InstallDate=20160512120434.985705+330
InUseCount=
LastAccessed=20160512120434.985705+330
LastModified=20160512120435.001305+330
Manufacturer=
Name=c:\users\jarilv\desktop\windirstat.lnk
Path=\users\jarilv\desktop\
Readable=TRUE
Status=OK
System=FALSE
Target=C:\Program Files (x86)\WinDirStat\windirstat.exe
Version=
Writeable=TRUE
To get only the details of the target of the shortcut, I have tried the command 'get target' ; but it giving error as Invalid query.
All other individual details (like for 'path', 'name', 'caption' etc.) is getting without any error.
Command --> wmic datafile where "path="\users\%username%\desktop\" and extension='lnk'" get target
Output -->
Node - SA-DOIT-CL1
ERROR:
Description = Invalid query
Why it will come as an invalid query, I'm asking for valid output, which is there in the 'get /value' query output itself.