[英]How do I read the contents of the network shortcuts folder in C#?
My network shortcuts folder is located here: 我的网络快捷方式文件夹位于:
C:\\Users\\elan\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts C:\\ Users \\ elan \\ AppData \\ Roaming \\ Microsoft \\ Windows \\ Network Shortcuts
This folder contains a number of shortcuts to web folders that I defined/configured. 此文件夹包含许多我定义/配置的Web文件夹的快捷方式。 These are visible in Window Explorer.
这些在Window Explorer中可见。 How do I get a directory listing of this folder to the shortcut files in code?
如何将此文件夹的目录列表添加到代码中的快捷方式文件中? I tried the below, but it returns no files:
我尝试了以下,但它没有返回任何文件:
string path = @"C:\Users\elan\AppData\Roaming\Microsoft\Windows\Network Shortcuts";
string[] files = Directory.GetFiles(path);
It turns out the entries in the Network Shortcuts folder are not files but are directories. 事实证明,网络快捷方式文件夹中的条目不是文件,而是目录。 The following worked:
以下工作:
string path = @"C:\Users\elan\AppData\Roaming\Microsoft\Windows\Network Shortcuts";
string[] dirs = Directory.GetDirectories(path);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.