这些 Windows 环境变量的含义是什么:HOMEDRIVE、HOMEPATH、HOMESHARE、USERPROFILE [英] What is the meaning of these Windows Environment variables: HOMEDRIVE, HOMEPATH, HOMESHARE, USERPROFILE

查看:81
本文介绍了这些 Windows 环境变量的含义是什么:HOMEDRIVE、HOMEPATH、HOMESHARE、USERPROFILE的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这些Windows环境变量是什么意思:

What is the meaning of these Windows Environment variables:

  • HOMEDRIVE,
  • 家庭路径,
  • 家庭共享,
  • 和 USERPROFILE?

谁设置的?什么时候?谁使用它们?为了做什么?

Who set them? When? Who use them? For doing what?

samba服务器的配置如何修改这些变量?

How the configuration of the samba server modify these variables?

推荐答案

USERPROFILEuserenv!LoadUserProfileW 设置,当加载用户的配置文件(HKEY_USERS\ 配置单元).

USERPROFILE is set by userenv!LoadUserProfileW which is called when, well, loading the user's profile (the HKEY_USERS\<sid> hive).

  • 这通常发生在用户第一次启动进程时.
  • 如果您特别安排不加载配置文件(例如,使用 /noprofile 用于 runas),则该过程将在 Default User 中运行仍然设置了这个变量的配置文件 - 从系统启动时被加载的那一刻起.
  • This typically happens the first time a process is started for the user.
  • If you specifically arranged not to load the profile (e.g. with /noprofile for runas) then the process is run in the Default User profile which still has this variable set - since the moment it was loaded at system's startup.

HOMEDRIVEHOMEPATHHOMESHARE(以及其他几个变量)由 shell32!RegenerateUserEnvironment 设置在 Explorer 初始化1 时调用.它们被放置在(易失性)HKCU\Volatile Environment 键中,该键是易失性的,在配置文件卸载之前一直存在.

HOMEDRIVE, HOMEPATH and HOMESHARE (as well as several other variables) are set by shell32!RegenerateUserEnvironment which is called on Explorer initialization1. They are placed in the (volatile) HKCU\Volatile Environment key which, being volatile, persists until the profile's unload.

  • 因此,它们仅在用户登录到桌面会话时设置.不适用于辅助登录或服务.

    1代码中还设置了一些userenv已经设置好的变量.这表明这是一个较旧的代码,自 NT4 天以来一直存在.配置文件和主路径之间的差异 - 服务器故障证实了这一点.

    1The code also sets a few variables that are already set by userenv. This suggests that this is an older code that persists since NT4 days. Difference between profile and home path - Server Fault confirms that.

    这篇关于这些 Windows 环境变量的含义是什么:HOMEDRIVE、HOMEPATH、HOMESHARE、USERPROFILE的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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