views:

23

answers:

1

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

REG ADD HKCU\Environment /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.

+1  A: 

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:

Vantomex
I've edited it a bit.
Vantomex

related questions