我在非系统文件夹中创建 url 链接(快捷方式)时遇到问题。该链接已在桌面上正确创建,没有任何问题,但如果我将路径更改为非系统文件夹,该文件夹仍为空,也没有错误消息。允许的路径有限制吗?为什么没有错误信息?代码如下:
private void urlShortcutToFolder(string linkName, string linkUrl)
{
//string deskDir = Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory);
//using (StreamWriter writer = new StreamWriter(deskDir + "\\" + linkName + ".url"))
string nonSystemDir = "C\\Downloads";
using (StreamWriter writer = new StreamWriter(nonSystemDir + "\\" + linkName + ".url"))
{
writer.WriteLine("[InternetShortcut]");
writer.WriteLine("URL=" + linkUrl);
writer.Flush();
}
}