#6758
Support 1
Participant

    Unfortunately it is not possible to call the Environ function in an applet. However it is possible to access environment variables using the Windows scripting host. The following sample code reads all environment variables:

    '-------------------------------------------------------------------------------
    ' Read environment variables
    ' Link: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsobjwshshell.asp
    '-------------------------------------------------------------------------------
     
    Sub Main(Client, GWEvent)
     
     dim item
     dim objEnv
     dim iMessage
     dim oWshShell
     
     Set oWshShell = CreateObject ("WScript.Shell")
     
     if oWshShell is nothing then
       exit sub
     end if
     
     ' Get the collection using the Environment property
     
     Set objEnv = oWshShell.Environment("Process")
     if objEnv is nothing then
       exit sub
     end if
     
    
     iMessage = "Environment variables" + vbcrlf + vbcrlf
     
     ' Read environment variables
     For Each item In objEnv
       iMessage = iMessage & vbcrlf & item
     Next
     
    
     msgbox iMessage
     
     set objEnv = nothing
     set oWshShell = nothing
     
    end Sub

    Advansys Support