Windows – How to re-source the environment variables in a command prompt in Windows

bashbashrccmd.exewindows

In a bash shell, you can edit your environment variables, run source ./.bashrc and refresh the values of environment variables in an already open shell. Does Windows have a similar command that you can run to do this from the command prompt?

(for instance I might change my system %PATH% variable in the properties of Computer, and then want my existing cmd.exe window to refresh the environment variables from there.

Best Answer

SET variable=string

Variable is the new variable you want to create (or an existing one)

String is what you want to assign to variable

Example of storing a text string:

C:> SET _dept=Sales and Marketing

Source: http://ss64.com/nt/set.html

NOTE: Changes made with SET will only remain for the CMD session.

Related Question