How to get file path of copied file in Windows?

Viewed 331

This is for files which I copy anywhere in explorer either from right click context menu or Ctrl+C.

I looked at System.Windows.Clipboard but there doesn't seem to be a method to get any information about a file which was copied.

Any help in appreciated.

2 Answers

this work for you

Clipboard is inside System.Windows.Forms, use this way:

if (Clipboard.ContainsFileDropList())
{
    var filesArray = Clipboard.GetFileDropList();
    //now you have a array of file address 
}
else if(Clipboard.ContainsText())
{
    var fileName = Clipboard.GetText();
}

Please Use This

Clipboard.GetFileDropList();
Related