简体   繁体   中英

how to get path to physical directory path of desktop in C#

在此处输入图像描述

I tried

Environment.GetFolderPath(Environment.SpecialFolder.Desktop);

Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);

they both return same results

This image in the question representing a Windows File Explorer view of the Desktop root item is a virtual view constructed by the explorer.

As I know it has no physical existence on the drive and its content varies with the Windows version from 95 to 10.

The Desktop folder in the User folder on the drive only contains links and files shown on the screen (the desktop).

Perhaps there is a WinAPI to get such list but I don't know. Perhaps it is somewhere in the registry. Perhaps you can found something with Explorer-like implementations.

How to create an Explorer-like folder browser control?

https://www.c-sharpcorner.com/UploadFile/17e8f6/windows-explorer-in-C-Sharp-net/

https://www.codeproject.com/Articles/15059/C-File-Browser

https://docs.microsoft.com/en-us/windows/win32/shell/folder-info

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM