Get file paths from the copied files in clipboard
05:37 09 May 2022

How can I get all the paths from copied files in windows clipboard?

I tried this code, but it only returns one file path of what I copied, is there a way to get all the copied paths?

import win32clipboard

win32clipboard.OpenClipboard()
try:
    data = win32clipboard.GetClipboardData(49159).decode('utf-16')
except:
    data = 'No data'
win32clipboard.CloseClipboard()

print(data)

This all the available formats I get with win32clipboard.EnumClipboardFormats()

    49161: 'DataObject',
    49458: 'Shell IDList Array',
    49901: 'DataObjectAttributes',
    49902: 'DataObjectAttributesRequiringElevation',
    49459: 'Shell Object Offsets',
    49467: 'Preferred DropEffect',
    49483: 'AsyncFlag',
    49158: 'FileName',
    49240: 'FileContents',
    49159: 'FileNameW',
    49462: 'FileGroupDescriptorW',
    49171: 'Ole Private Data'
python