Is this what you seek?
Be sure to look at the entire file as much of the NSIS details are not shown in the sample and further along in the code.
Be aware that for the NSIS install of SWI-Prolog on Windows there is currently a problem if one picks the uninstall option during the NSIS install. (ref). To avoid the problem just do not try to uninstall SWI-Prolog on Windows using NSIS when given the option. Installing SWI-Prolog on Windows with a current install has not caused any problems I am aware.