WindowsAppSDK icon indicating copy to clipboard operation
WindowsAppSDK copied to clipboard

StorageFile should support representing shortcut files

Open jaigak opened this issue 5 years ago • 2 comments

Today StorageFile doesn't support shortcut file (ones with .lnk, .url or .wsh) and invoking any method throws an exception. Please let StorageFile represent shortcut files. Another thing is in File Explorer, the Share option for shortcut files is greyed out. It would be better if it shared the actual URI or file that the shortcut file instead of not allowing the option to share at all.

jaigak avatar Mar 04 '21 08:03 jaigak

@Jaiganeshkumaran StorageFile does support representing shortcut files. You can test this by dragging any shortcut files from explorer to a XAML app and it would be detected as a StorageFile. The only issue I can test is you can't get StorageFile object from StorageFile.GetFileFromPathAsync (or any StorageFile API that uses name to retrieve file) if the path points to a shortcut. Is there any other api that fails for you?

soumyamahunt avatar Jul 11 '21 12:07 soumyamahunt

Part Of:

  • #8.

mominshaikhdevs avatar Jun 19 '25 02:06 mominshaikhdevs

Hi @jaigak, thanks for raising this topic. We’ve introduced the new Microsoft.Windows.Storage.Pickers APIs - feel free to take a look when you have a moment: FileOpenPicker.FileTypeFilter Property

The new pickers can pick .lnk path by specifying .lnk among the FileTypeFilter:

var pk = new FileOpenPicker(default)   // if in an app window, use `new FileOpenPicker(this.AppWindow.Id)`
{
    FileTypeFilter = { ".lnk", "*" },
};
var res = await pk.PickSingleFileAsync();
Console.WriteLine($"Picked file: {res?.Path ?? "No file picked"}");
Image

DinahK-2SO avatar Oct 10 '25 08:10 DinahK-2SO