如何在 rebol 中获取 get-env 刷新?

发布于 2024-09-05 20:11:35 字数 99 浏览 1 评论 0原文

如果我更改注册表中的 hkey_current_user/environment/path , get-env "PATH" 不会反映新值,除非我关闭 rebol 控制台并重新打开它。

if i change hkey_current_user/environment/path in registry, get-env "PATH" doesn't reflect the new value unless I close rebol console and re_open it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

赢得她心 2024-09-12 20:11:35

环境变量注册表项

Windows 在设置程序从 shell 启动时获得的默认环境时,确实会查阅特定的注册表项。但是,更改它不会将这些值注入到已经运行的进程的环境中(在 Rebol 或任何其他程序中)。相反,如果您在正在运行的程序的环境中进行设置,您将不会看到这些更改反映回注册表中。

如果您想读取注册表值,可以使用一个 API:

http://www .rebol.com/docs/sdk/registry.html

但是正确或错误:人们普遍认为(在我使用过的每个平台上)必须退出程序并重新启动它为了从系统设置刷新环境变量。如果你尝试解决这个问题,可能会导致比其他任何事情都更加复杂和混乱。

Environment variables are not the same things as Registry Keys.

Windows does consult particular registry keys when it is setting up the default environment a program gets when it launches from the shell. However, changing it won't inject those values into the environments of already running processes (in Rebol or any other program). Conversely, if you set things in the environment of a running program you won't see those changes reflected back into the registry.

If you want to read registry values, there is an API for that:

http://www.rebol.com/docs/sdk/registry.html

BUT rightly or wrongly: it is generally accepted (on every platform I've used) that one must exit a program and restart it in order to refresh environment variables from system settings. If you try and work around that, you may cause more complexity and confusion than anything else.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文