gpt4 book ai didi

windows - 如何在 MS Windows 中更改 "local system"帐户的 %PATH% 值?

转载 作者:可可西里 更新时间:2023-11-01 12:43:03 27 4
gpt4 key购买 nike

我正在努力在 MS Windows 中为“本地系统”帐户设置 %PATH% 变量。

我在 %PATH% 变量中添加了一些路径。这条新路径(包括这条路径中的工具)运行良好。使用 CMD 可以毫无问题地运行该路径中的工具。但是一旦要从 ms windows services.msc 作为服务运行相同的工具,它就会说没有这样的工具。因此出于某种原因,%PATH% 变量没有为“本地系统”帐户更新。

我发现可以通过以下方式访问此帐户的 CMD:

psexec -i -s cmd.exe

事实上,我发现 CMD 以这种方式运行,并且 PATH 变量没有所需的工具路径。但是我不能编辑它;我使用 setsetx 但在“本地系统”帐户的 %PATH% 中仍然看不到任何更改。

最佳答案

我想在 MS Windows 中为“本地系统”帐户设置 %PATH% 变量。

您需要重新启动 Windows。


在重新启动 Windows 之前,您对环境变量所做的更改不会影响在本地系统帐户下运行的服务

If you update environment variables or add new environment variables, you must restart the computer before the changes that you make affect services that run under the Local System account.

This behavior occurs because services that run under the Local System account inherit their environment from the Services.exe process. The Services.exe process receives the environment settings for the Local System account when Windows starts. Because the Services.exe process does not use Windows Messaging, when it receives messages that indicate that a value has changed after Windows starts, the Services.exe process does not update its environment settings. You cannot force a service that is running to acknowledge a dynamic change to the environment of the Local System account.

来源Changes that you make to environment variables do not affect services that run under the Local System account until you restart Windows

关于windows - 如何在 MS Windows 中更改 "local system"帐户的 %PATH% 值?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32068893/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com