如何以编程方式将文件夹添加到用户的收藏夹(在 Windows 资源管理器中)?
我正在寻找一种以编程方式将文件夹添加到 Windows 资源管理器中的收藏夹的方法。它特定于 Windows 资源管理器并基于此项目: http: //www.codeproject.com/Tips/132804/Open-folders-using-a-Run-Command
到目前为止,我已经尝试过进程监视器并搜索注册表,但我似乎找不到我的 Windows regedit
中的资源管理器收藏夹。
I am looking for a way to programmatically add a folder to the Favorites in Windows Explorer. Its Windows Explorer specific and based around this project: http://www.codeproject.com/Tips/132804/Open-folders-using-a-Run-Command
So far I've tried Process Monitor and searching the registry, but I can't seem to find my Windows Explorer Favourites in regedit
.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您可以执行以下操作,而不是读取注册表:
Instead of reading the registry, you can do the following:
我不确定这是否是您要查找的内容,但我认为可以通过以下注册表值找到最喜欢的文件夹:
您应该能够使用以下代码检索此文件夹名称:
那么这只是一个问题在指定文件夹中创建链接或文档。
(请注意,此键的值可能类似于
%USERPROFILE%\Favorites
;环境变量应通过上面调用的.GetValue(..)
方法自动扩展。 )I'm not sure if this is what you're looking for, but I think the favorite folder can be found through the following registry value:
You should be able to retrieve this folder name with the following code:
It's then only a matter of creating a link, or document, in the specified folder.
(Take note that this key's value might be something like
%USERPROFILE%\Favorites
; the environment variable should automatically get expanded by the.GetValue(..)
method invoked above.)对于 Windows 8,此位置已更改为 %USERPROFILE%\Links。请参阅此答案。
For Windows 8 this location has been changed to %USERPROFILE%\Links. Please refer to this answer.
从 Vista 开始,添加了 FOLDERID_Links const。它指向 Windows 资源管理器的收藏夹。我的代码(Delphi,但主要思想是可见的):
Starting from Vista FOLDERID_Links const was added. It points to Favorites of Windows explorer. My code (Delphi, but the main idea is visible):