Jump to content

Computer Informations


Recommended Posts

RunWait(@ComSpec & " /c ipconfig /all > c:\compinfo.log")
$file = FileOpen("c:\compinfo.log", 0)
$line = FileReadLine($file)
While Not StringInStr($line, 'Hostname')
    $line = FileReadLine($file)
WEnd
$hn = StringTrimLeft($line, StringInStr($line, ': ')+1)
MsgBox(0, '', $hn)

Link to post
Share on other sites

If you need several things, try this code. Alter content of $search_for to those things you need, separated by commas.

$search_for = 'Hostname,DNS-Server,Gateway'

$array = StringSplit($search_for, ',')
Dim $result[$array[0]+1]
RunWait(@ComSpec & " /c ipconfig /all > c:\compinfo.log")
$file = FileOpen("c:\compinfo.log", 0)
$line = FileReadLine($file)
While @error=0
    For $i = 1 To $array[0]
        If StringInStr($line, $array[$i]) Then
            $result[$i] = StringTrimLeft($line, StringInStr($line, ': ')+1)
        EndIf
        $line = FileReadLine($file)
    Next
WEnd
FileClose($file)

For $i = 1 To $array[0]
    MsgBox(0, '', $array[$i] & ': ' & $result[$i])
Next
Edited by ZeDMIN
Link to post
Share on other sites

For $i = 1 To $array[0]

    MsgBox(0, '', $array[$i] & ': ' & $result[$i])

Next

<{POST_SNAPBACK}>

In the MsgBox: The array[$i] is the name of the thing you were looking for. If you only want the result you only have to take result[$i].

Was that what you were asking for?

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...