获取Chrome浏览器下载文件夹 [英] Get chrome downloads folder
问题描述
在Windows 7的默认下载文件夹的 C:\users\username\downloads 的Chrome浏览器。但是默认的下载文件夹,可以设置为通过设置另一个文件夹。我需要找出哪些文件夹是下载文件夹。所以,如果我设置下载文件夹到的 C:\dd 的,那么我需要找出特定的文件夹。
The default downloads folder in Windows 7 is c:\users\username\downloads for Chrome. But default downloads folder can be set to another folder through settings. I need to find out which folder is the downloads folder. So if I set the downloads folder to c:\dd, then I need to find out the specific folder.
有没有发现这一点,使用的的办法C#的?我的意思是我不想访问Chrome浏览器设置,并从那里获取的文件夹路径。
Is there a way of finding this out using C#? I mean I don't want to visit the chrome settings and fetch the folder path from there.
推荐答案
The default locations for Chrome settings are here. I actually found mine to be under 'C:\Users[UserName]\AppData\Local\Google\Chrome\User Data\Default' for Chrome 20.0.1132.47.
如果您打开偏好设置文件,可以解析JSON来获得下载文件夹:
If you open the Preferences file, you can parse the JSON to get the download folder:
"download": {
"default_directory": "C:\\Users\\[UserName]\\Downloads",
"directory_upgrade": true,
"extensions_to_open": ""
}
如果没有 default_directory
值,然后将目录 C:\Users\ [用户名] \Downloads 正在使用。
If there is no default_directory
value, then the directory C:\Users\[UserName]\Downloads is being used.
这篇关于获取Chrome浏览器下载文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!