Windows用户配置文件路径文件夹 [英] Windows user profile path folders

查看:47
本文介绍了Windows用户配置文件路径文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

谁能在DotNet的屏幕快照中描述如何获取以下文件夹以及这些文件夹的作用?下面的文字在Dotnet名称空间中被描述为缺少".

Can anyone describe how to get the following folders in screenshot in DotNet and what these folder are for? Below in the text described as "Missed" in Dotnet namespace.

我只能通过 My.Computer.FileSystem.SpecialDirectories

.

属性....目的

AllUsersApplicationData

应用程序应在其中存储所有用户设置的目录(通常,类似C:\ ProgramData \ WindowsApplication1 \ WindowsApplication1 \ 1.0.0.0).

The directory where applications should store settings for all users (typically, something like C:\ProgramData\WindowsApplication1\WindowsApplication1\1.0.0.0).

CurrentUserApplicationData

应用程序应在其中存储当前设置的目录用户(通常是类似C:\ Users \ PeterBlue \ AppData \ Roaming \ WindowsApplication1 \ WindowsApplication1 \ 1.0.0.0).

The directory where applications should store settings for the current user (typically, something like C:\Users\PeterBlue\AppData\Roaming\WindowsApplication1\WindowsApplication1\1.0.0.0).

台式机

当前用户的桌面目录(通常,C:\ Users \ PeterBlue \ Desktop).

The current user's desktop directory (typically, C:\Users\PeterBlue\Desktop).

我的文档

当前用户的我的文档"目录(通常,C:\ Users \ PeterBlue \ Documents).

The current user's My Documents directory (typically, C:\Users\PeterBlue\Documents).

MyMusic

当前用户的我的音乐"目录(通常,C:\ Users \ PeterBlue \ Music).

The current user's My Music directory (typically, C:\Users\PeterBlue\Music).

MyPictures

当前用户的我的图片"目录(通常,C:\ Users \ PeterBlue \ Pictures).

The current user's My Pictures directory (typically, C:\Users\PeterBlue\Pictures).

ProgramFiles

程序文件目录(通常为C:\ Program Files).

The Program Files directory (typically, C:\Program Files).

程序

当前用户的Programs目录(通常,C:\ Users \ PeterBlue \ AppData \ Roaming \ Microsoft \ Windows \ Start菜单\程序).

The current user's Programs directory (typically, C:\Users\PeterBlue\AppData\Roaming\Microsoft\Windows\Start Menu\Programs).

温度

当前用户的临时目录(通常,C:\ Users \ PeterBlue \ AppData \ Local \ Temp).

The current user's temporary directory (typically, C:\Users\PeterBlue\AppData\Local\Temp).

DotNet名称空间中的

丢失和丢失的信息:

Missed in DotNet namespace and missed information:

  • 管理员
  • 默认
  • 默认用户(为什么会有钥匙标以及如何获得访问权限?)
  • 用户

.

*自己的解决方案*

我自己解决文件夹问题的方法是将命令行 cmd Dir/ah 例如:现在,我们可以看到实际文件夹是"C:\ Users \ Public \ Documents",而不是"C:\ Users \ All Users",可以通过 Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)访问代码>

My own solution in getting out of the folder issue is to use use commandline cmd with Dir /ah ex: Instead of "C:\Users\All Users" now we can see the real folder is "C:\Users\Public\Documents" which is reachable throught Environment.GetFolderPath(Environment.SpecialFolder.CommonDocuments)

推荐答案

请注意,您不应使用这些配置文件文件夹来猜测可以从Environment.GetFolderPath中检索到的任何内容.SHSetFolderPath或其他一些工具可以更改从那里获得的任何内容.支持这些文件夹的检索方式已经记录在案(Environment.GetFolderPath,SHGetFolderPath等)

Note you should not use those profile folders to guess anything that you can retrieve from Environment.GetFolderPath. Anything you can get from there can be changed by SHSetFolderPath or some other tool. The supported way to retrieve those folders are documented already (Environment.GetFolderPath, SHGetFolderPath etc)

  • Administrator/ user :名为Administrator/ user 的用户的配置文件的默认位置.可以通过 GetUserProfileDirectory 带有用户令牌.
  • 默认:创建新用户时使用的模板用户配置文件的默认位置,可以通过 GetProfilesDirectory \默认用户.除非通过 SysPrep 更改了默认用户配置文件目录,否则对此文件夹进行的自定义无效.使用文档化的API避免此类问题始终是一个好主意.
  • Administrator/user: default location for profile of the user named Administrator/user. Can be retrieved via GetUserProfileDirectory with a user token.
  • Default: default location of the template user's profile, which is used when creating a new user, can be retried by GetDefaultUserProfileDirectory
  • Default User : Some OEMs may create this folder by mistake. Possibly a leftover from code carelessly written for XP where the default user profile is stored in GetProfilesDirectory\Default User. Customization made to this folder has no effect unless the default user profile directory is changed by SysPrep. It is always a good idea to use documented APIs to avoid issues like this.

Environment.SpecialFolder是

Environment.SpecialFolder is a wrapper of CSIDL values, so it does not include flag for the default user profile or for another user.

这篇关于Windows用户配置文件路径文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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