You can set the value of environment variables within Maya by using the putenv command in the command line.
Examples:
putenv "MAYA_RENDER_SETUP_INCLUDE_ALL_LIGHTS" "0"
putenv "MAYA_CUSTOM_TEMPLATE_PATH" ";C:/Users/myName/Documents/myTemplatePath"
Likewise, you can get the value of an environment variable within Maya by using the getenv command.
Examples:
getenv "MAYA_RENDER_SETUP_INCLUDE_ALL_LIGHTS"; // Result: 0 //
getenv "MAYA_CUSTOM_TEMPLATE_PATH"; // Result: ;C:/Users/myName/Documents/myTemplatePath //
For more information regarding these commands, see the MEL Command reference.
Environment variables set within the Maya command line are only saved for the current instance of Maya.