开发者

Can I create Environmental variable which will take effect without logoff

开发者 https://www.devze.com 2023-01-22 17:51 出处:网络
I am creating an Envoirment var using a bat file and the command is below: REG ADD HKCU\\Environmen开发者_StackOverflowt /v DSPATH /t REG_SZ /d %cd%\\DSClient.exe

I am creating an Envoirment var using a bat file and the command is below:

REG ADD HKCU\Environmen开发者_StackOverflowt /v DSPATH /t REG_SZ /d %cd%\DSClient.exe

This works fine but only after a logoff. Is there a way it can take effect without logging off.


You can use Setx command to modify environment variables in the user or system environment, without requiring programming or scripting.

Programmatically, to effect these changes without having to log off, broadcast a WM_SETTINGCHANGE message to all windows in the system, so that any interested applications (such as Windows Explorer, Program Manager, Task Manager, Control Panel, and so forth) can perform an update.

See:

  • How to propagate environment variables to the system
  • Refreshing environment variables from the command prompt
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号