简体   繁体   English

如何访问 AppData 文件夹

[英]How to Access AppData Folder

i looked at every question in SO, but i dont found any solution for my Problem.我查看了 SO 中的每个问题,但没有找到任何解决我的问题的方法。

I want to Access the Appdata Folder like this:我想像这样访问 Appdata 文件夹:

 Storagefolder foldertree = 
    await StorageFolder.GetFolderFromPathAsync(@"C:\Users\Username\AppData");

Actually i use the Spring Update so i can Target every Folder but not the AppData.实际上我使用 Spring 更新,所以我可以定位每个文件夹,但不是 AppData。

I know that the reason is that the Folder is hidden.我知道原因是文件夹被隐藏了。

So anyone got a solution the Access hidden Folders?那么有人有解决办法访问隐藏文件夹吗?

Universal Windows Apps (apps) can access certain file system locations by default.默认情况下,通用 Windows 应用程序(应用程序)可以访问某些文件系统位置。 Apps can also access additional locations through the file picker, or by declaring capabilities应用程序还可以通过文件选择器或通过声明功能来访问其他位置

You can try using file picker and navigate to folder.您可以尝试使用文件选择器并导航到文件夹。 But im sure you need the app to pickup file automatically without filepicker但是我确定您需要该应用程序在没有文件选择器的情况下自动拾取文件

  • Application install directory.应用程序安装目录。 The folder where your app is installed on the user's system.您的应用程序安装在用户系统上的文件夹。 Windows.Storage.StorageFolder installedLocation = Windows.ApplicationModel.Package.Current.InstalledLocation;
  • Application data locations .应用程序数据位置 The folders where your app can store data.您的应用程序可以存储数据的文件夹。 These folders (local, roaming and temporary) are created when your app is installed.这些文件夹(本地、漫游和临时)是在您的应用程序安装时创建的。

    using Windows.Storage; StorageFolder localFolder = ApplicationData.Current.LocalFolder;

  • User's Downloads folder .用户的下载文件夹 The folder where downloaded files are saved by default.默认保存下载文件的文件夹。 App can only access files and folders in the user's Downloads folder that your app created.应用程序只能访问您的应用程序创建的用户下载文件夹中的文件和文件夹。 However, you can gain access to files and folders in the user's Downloads folder by calling a file picker (FileOpenPicker or FolderPicker) so that users can navigate and pick files or folders for your app to access.但是,您可以通过调用文件选择器(FileOpenPicker 或 FolderPicker)来访问用户下载文件夹中的文件和文件夹,以便用户可以导航和选择您的应用程序要访问的文件或文件夹。

File Access Permissions 文件访问权限

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM