Question

I have a lnk file (shortcut file). I have used a tool called Windows LNK Parsing Utility (lp) to find out the volume serial number that the original file was sitting on. So I wanted to create a script in python that does the same.

I found that the win32api module should help, so here is my code:

import win32api, win32con, win32security # win32api main mod, other modules to get SID

path = ('C:\Users\Si\Desktop\Files\Shortcut to Pictures.lnk')

print win32api.GetVolumeInformation(path)


Error says:

Traceback (most recent call last):
File "C:\Users\Si\Desktop\Files\test.py", line 3, in <module> pywintypes.error: (123, 'GetVolumeInformation', 'The filename, directory name, or volume label syntax is incorrect.')

Is there another (perhaps better?) way of accomplishing this?

Thank you

Was it helpful?

Solution

From documentation

tuple = GetVolumeInformation(path)

Returns information about a file system and colume whose root directory is specified.

May be

win32api.GetVolumeInformation('C:\\')
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top