How can I create or change an environment variable
From NSIS Wiki
This Wiki contains all the information you need to know about this:
Setting Environment Variables, Setting Environment Variables to Active Installer Process.
It also contains information about changing the PATH environment variable:
Path Manipulation, Path manipulation with all users/current user selection in run-time.

