Type in “regedit” from the Windows search function and open the Registry Editor.
There will be 2 type of environment variables,
SYSTEM VARIABLES
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
USER VARIABLES
HKEY_CURRENT_USER\Environment
So, to export right click on the Environment directory and choose on Export. You can save the file in .reg or in .txt format.