在VB.NET中访问“用户下载"文件夹 [英] Accessing the User Downloads Folder in VB.NET

查看:121
本文介绍了在VB.NET中访问“用户下载"文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好.我想知道如何才能在VB.NET中获得用户的下载文件夹(在Windows Vista和7中)的路径.

我当前访问此文件夹的尝试是获取用户的音乐目录,从该路径中减去""Music"字符串,然后向其中添加下载".但是,我遇到一个错误,说它无法将"C:\ Users \ USERNAME \ Music"转换为双精度.

另外,我尝试创建"C:\ Users \"路径,添加用户名,然后将downloads目录添加到该目录的末尾.也不是那么好.

谢谢!

Hi there. I''m wondering how I would be able to get the path for the user''s download folder (in Windows Vista and 7) in VB.NET.

My current attempt at accessing this folder was to get the user''s music directory, "subtract" the "Music" string from that path, and add "Downloads" to it. However, I got an error that said that it couldn''t convert "C:\Users\USERNAME\Music" to a double.

Also, I tried creating the "C:\Users\" path, adding the user''s name, and then adding the downloads directory to the end of that. That didn''t work out so well, either.

Thanks!

推荐答案

大多数特殊文件夹都可以通过以下方式访问: Environment.GetFolderPath(Environment.SpecialFolder.MyMusic).
但是此枚举不包括下载" ...
堆栈溢出显示了一个解决方案: http://stackoverflow.com/questions/3795023/downloads- folder-not-special-enough [ ^ ].
Most special folders can be reached with e.g. Environment.GetFolderPath(Environment.SpecialFolder.MyMusic).
But "Downloads" is not covered by this enumeration...
A solution was shown on stack overflow: http://stackoverflow.com/questions/3795023/downloads-folder-not-special-enough[^].


这篇关于在VB.NET中访问“用户下载"文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆