How can I get the value of a custom environment variable in a classic ASP page using VBScript?
The following worked for me, based on this article
Set objWSH = CreateObject("WScript.Shell")
'This actually returns all the User Variables, and you either loop through all, or simply print what you want
Set objUserVariables = objWSH.Environment("USER")
MsgBox(objUserVariables("TEMP"))
'This returns all the System Variables, and you either loop through all, or simply print what you want
Set objSystemVariables = objWSH.Environment("SYSTEM")
MsgBox(objSystemVariables("PATH"))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With