how to read the windows shortcuts in python

February 27, 2011 at 12:29:26
Specs: Windows XP
Hi, I want to know the target path of a windows shortcut. How do i read the short cut & retrieve the actual target path it is pointing to in python language.

Thanks
Ayaskant
Bangalore


See More: how to read the windows shortcuts in python

Report •

#1
Report •

#2
March 4, 2011 at 03:41:25
Hi razor, Thanks for posting this link which says about using COM objects to handle shortcuts. But My requirement is bit different. I don't want to create a new shortcut or update an existing one. What I want is to read the target location from an existing shortcut. The shortcut can be anywhere in my computer & not necessarily on desktop. For example - C:\temp\my_shortcut.lnk which is pointing to D:\john\temp\myfile.txt file. Here i can pass the shortcut path "C:\temp\my_shortcut.lnk" to the python script, but there i want to retrieve the actual target file 's location from that shortcut. Some thing equivalent of os.readlink(symlink) on Unix systems. Is there any way to do that using win32com.shell modules.

Report •
Related Solutions


Ask Question