Using built-in g_helper object

var helloUser = g_helper.ResolveEnvironmentVariables("Hello, %UserName%")


Using Process Environment

var WshShell = new ActiveXObject("WScript.Shell");
var _processEnv = WshShell.Environment("PROCESS");
var userName = _processEnv("UserName");

Expanding the String

var WshShell = new ActiveXObject("WScript.Shell");
var helloUser = WshShell.ExpandEnvironmentStrings("Hello, %UserName%")