How to export and import environment variables in windows?

后端 未结 8 1533
粉色の甜心
粉色の甜心 2020-12-22 15:36

I found it is hard to keep my environment variables sync on different machines. I just want to export the settings from one computer and import to other ones.

I thi

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-22 15:49

    You can get access to the environment variables in either the command line or in the registry.

    Command Line

    If you want a specific environment variable, then just type the name of it (e.g. PATH), followed by a >, and the filename to write to. The following will dump the PATH environment variable to a file named path.txt.

    C:\> PATH > path.txt
    

    Registry Method

    The Windows Registry holds all the environment variables, in different places depending on which set you are after. You can use the registry Import/Export commands to shift them into the other PC.

    For System Variables:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    

    For User Variables:

    HKEY_CURRENT_USER\Environment
    

提交回复
热议问题