[python-win32] How to get target of folder shortcuts

Tim Roberts timr at probo.com
Mon Mar 18 12:54:57 EDT 2019


kurt wrote:
> Hello, I'm trying to get the target filename of windows shortcuts.  The
> code below works great for regular shortcuts, but errors out on "folder
> shortcuts".
> ...
> The code below works great for regular .lnk shortcuts, but folder
> shortcuts give me:
> 	[...]
>      persistFile.Load(fname,STGM_READ)
> pywintypes.com_error: (-2147024891, 'Access is denied.', None, None)
>
> The quirk with folder shortcuts is they have some DOS attributes set,
> which I suspect could be causing me trouble.  Is there, perhaps,
> something I need to do to get my IPersistFile to ignore file attributes?

Your code works for me, although the SFGAO_FOLDER bit is not set for my 
folder shortcut.  If you do a "dir" of the folder where the link lives, 
what do you see?  Is it actually a .lnk file of about a kilobyte?

There are no DOS attributes on my folder shortcut.  What do you see?

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3980 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.python.org/pipermail/python-win32/attachments/20190318/b639895b/attachment.bin>


More information about the python-win32 mailing list