Results 1 to 4 of 4

Thread: Retrieving Environment Variables

  1. #1

    Thread Starter
    Hyperactive Member Gimpster's Avatar
    Join Date
    Oct 1999
    Location
    Redmond, WA 98052
    Posts
    331

    Question

    I was wondering what I need to do to be able to retrieve an environment variable, specifically the COMPUTERNAME environment variable. Thanks. Oh and I'm doing this in VBScript, so if it's different in VBScript, please tell me that way. Otherwise, I'll just try to do it the same as VB.
    -Ryan
    I smell varmint poontang, and the only good varmint poontang is dead varmint poontang...

    -Bill Murray, Caddyshack

  2. #2
    Junior Member
    Join Date
    Feb 2000
    Location
    Netherlands
    Posts
    27
    A little bit late but you can try this in your vbs-file and run it from the commandprompt with cscript.exe:

    dim Server
    Set Server = CreateObject("Wscript.Network")
    strServer = server.ComputerName
    wscript.echo "Servername = " & strServer


    gr. Hans


  3. #3
    PowerPoster
    Join Date
    Jan 2001
    Location
    Florida
    Posts
    3,216
    how do I find the same but using VB? What is the reference?

  4. #4
    Junior Member
    Join Date
    Feb 2000
    Location
    Netherlands
    Posts
    27

    It's almost the same

    Make VB-project with a form and a command button "Command1":
    Private Sub Command1_Click()
    Dim Server
    Set Server = CreateObject("Wscript.Network")
    strserver = Server.ComputerName
    MsgBox ("Servername: " & strserver)
    End Sub

    Reference:
    http://msdn.microsoft.com/library/de...intro_0zsj.htm

    gr. HansZ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width