获取chrome下载文件夹 [英] Get chrome downloads folder
问题描述
Windows 7中的默认下载文件夹是Chrome的 c:\users\username\downloads 。但默认的下载文件夹可以通过设置设置到另一个文件夹。我需要找出哪个文件夹是下载文件夹。所以如果我将下载文件夹设置为 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.
推荐答案
Chrome的默认位置设置为此处。我实际上发现我的Chrome在<20.0>下的 C:\Users [UserName] \AppData\Local\Google\Chrome\User Data\Default 。 1132.47
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\ [UserName] \Downloads 正在使用。
If there is no default_directory
value, then the directory C:\Users\[UserName]\Downloads is being used.
这篇关于获取chrome下载文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!