[python-win32] How to read the target of a Windows Shortcut

Ayaskanta Swain ayaskanta.swain at altair.com
Fri Mar 4 15:29:32 CET 2011


Hi David,

 

Yes I need to do some thing like you have suggested. Will try to open
the link & catch the exception in case of any error. Though it's a
indirect way but I am quite optimistic that it will work for me.

 

Thanks

Ayaskant-

 

-----Original Message-----
From: David Hutto [mailto:smokefloat at gmail.com] 
Sent: Friday, March 04, 2011 6:30 PM
To: Ayaskanta Swain
Cc: Tim Golden; python-win32 at python.org
Subject: Re: [python-win32] How to read the target of a Windows Shortcut

 

On Fri, Mar 4, 2011 at 7:58 AM, David Hutto <smokefloat at gmail.com>
wrote:

> On Fri, Mar 4, 2011 at 7:27 AM, Ayaskanta Swain

> <ayaskanta.swain at altair.com> wrote:

>> Hi,

>> 

>> 

>> 

>> Thank you for sending me the link. I tried it by copying the

>> "shortcut_target(filename)" function into my script. But it does the
same

>> thing as I had mentioned in my previous e-mail. i.e It returns me the
target

>> path correctly if the target exists physically in my hard disk, but
behaves

>> in a wrongful manner if I delete the target keeping the shortcut
intact

>> (Broken shortcut). In that case it creates an empty file (0 size)
with the

>> same name as that of the existing target & creates it at the same
physical

>> location where the target was existing before. Looks like a bug in
this

>> function.

> 

> try:

>  open file

> 

> except:

>  file doesn't exist

> 

> or something of the such.

 

in other words, try to fix what it does, stop the creation of the file

IF it doesn't exist. I'm trying to give the homework explanations,

instead of pseudo code, just like the grandmaster peers.

 

>> 

>> 

>> 

>> I want to see it fail in that case or return something lie NONE , but
it

>> still returns me the target path.

>> 

>> 

>> 

>> Thanks

>> 

>> Ayaskant-

>> 

>> 

>> 

>> -----Original Message-----

>> From: python-win32-bounces+ayaskanta.swain=altair.com at python.org

>> [mailto:python-win32-bounces+ayaskanta.swain=altair.com at python.org]
On

>> Behalf Of Tim Golden

>> Sent: Friday, March 04, 2011 5:30 PM

>> Cc: python-win32 at python.org

>> Subject: Re: [python-win32] How to read the target of a Windows
Shortcut

>> 

>> 

>> 

>> On 04/03/2011 11:59, Ayaskanta Swain wrote:

>> 

>>> 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? I

>> 

>>> searched the internet & all the documents I found there refer to use

>> 

>>> Win32com.shell or win32com.client module but was not satisfied with
the

>> 

>>> solutions given there.

>> 

>> 

>> 

>> Well I don't know if this was one of the solutions with which

>> 

>> you were "not satisfied", but it does at least have the merit

>> 

>> of working:

>> 

>> 

>> 

>>    http://timgolden.me.uk/python/win32_how_do_i/read-a-shortcut.html

>> 

>> 

>> 

>> TJG

>> 

>> _______________________________________________

>> 

>> python-win32 mailing list

>> 

>> python-win32 at python.org

>> 

>> http://mail.python.org/mailman/listinfo/python-win32

>> 

>> _______________________________________________

>> python-win32 mailing list

>> python-win32 at python.org

>> http://mail.python.org/mailman/listinfo/python-win32

>> 

>> 

> 

> 

> 

> --

> According to theoretical physics, the division of spatial intervals as

> the universe evolves gives rise to the fact that in another timeline,

> your interdimensional counterpart received helpful advice from me...so

> be eternally pleased for them.

> 

 

 

 

-- 

According to theoretical physics, the division of spatial intervals as

the universe evolves gives rise to the fact that in another timeline,

your interdimensional counterpart received helpful advice from me...so

be eternally pleased for them.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20110304/675d510a/attachment-0001.html>


More information about the python-win32 mailing list