Update environment variables from the command line (Windows 2008 Server Core)

windows-server-2008

Fairly straightforward question. I need to update my PATH environment variable in Windows Server 2008 Core. Considering there's no GUI, how is this done from the command line?

Best Answer

To make persistent changes use setx.

For example, to add a folder to the end of the current path, use:

SETX Path %Path%;C:\MyFolder

Your change won't be visible in the current cmd.exe session, but it will be in all future ones.

SETX also allows setting system environment variables on remote systems.