如何获取Win7中的库/图片的完整路径? [英] How to get full path of libaries/Pictures in Win7?
本文介绍了如何获取Win7中的库/图片的完整路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在Win7下,资源管理器视图中有一个名为库"的新功能,该功能具有指向图片",文档"等的链接(此外,您还可以添加自己的链接).
这些库是虚拟路径.
在C#的任一VB.Net中:
任何人都可以告诉我如何获得任何库的完整物理路径吗?
例如,以图片"为例,我如何获取完整路径.
感谢
Hi,
Under Win7, in the explorer view there is a new feature called "Libaries" which have links to "Pictures", "documents" etc(plus you can add your own).
These libraries are virtual paths.
In either VB.Net of C#:
Can anyone please tell me how I can get the full physical path of any of the libaries?
Lets say for example "Pictues" how do I get the full path.
Thanks
推荐答案
此处是Windows 7库中的MSDN文章,以及有关如何选择和使用它们的详细信息.
http://msdn.microsoft.com/en-us/magazine/dd861346.aspx [ ^ ]
另外,如果您查看My.Computer.FileSystem.SpecialDirectories
您可以访问MyPictures,MyMusic,Desktop等.
Here is an MSDN article on Windows 7 Libraries, and details on how to select and consume them.
http://msdn.microsoft.com/en-us/magazine/dd861346.aspx[^]
Also if you look atMy.Computer.FileSystem.SpecialDirectories
you can get access to MyPictures, MyMusic, Desktop etc.
string SpecialDir(string name = "MyPictures")
{
Dictionary<string, string> specDir = new Dictionary<string, string>();
foreach (System.Environment.SpecialFolder sFolder in Enum.GetValues(typeof(System.Environment.SpecialFolder)))
{
try
{
specDir.Add(sFolder.ToString(), System.Environment.GetFolderPath(sFolder));
}
catch
{
// Try-Catch to ignore Duplication
}
}
return specDir[name];
}
这篇关于如何获取Win7中的库/图片的完整路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文