How do I find through Python the icon associated with a Windows file?
I am developing a Python script to manage files on Windows. Basically, I want to be able to move files to a different location and instead create a shortcut to a Python script that will do intermediate steps before opening the moved file. Currently, I can move files, create shortcuts and set a shortcut. The only thing I have left is to figure out how to determine the icon that is displayed for the file.
-Support setting an icon for a shortcut (which points to a ".py" script)
-This character must match the value of an arbitrary file type, exe, etc., which has a path to
- Hopefully this is done programmatically via Python. os.system () are acceptable. Extra credit is given for the lack of additional modules (although I already have win32com, winshell, pythoncom, etc.)
Thanks in advance...
source to share
The file type information is located in the registry . You can find the file extension type using the Windows Registry .
Edit : The icons available through shell32 are displayed as shown here . Seems to be the Python equivalent ctypes.windll.shell32.ExtractIconA
, although I'm not sure about the syntax.
source to share