Sign in to follow this  
Followers 0
vickerps

IP address

3 posts in this topic

Hi Guys

I know about @IPadress1

But i also want Subnet and Gateway how can i get these

Share this post


Link to post
Share on other sites



Parsing IPConfig /all result?

Share this post


Link to post
Share on other sites

This should do ya:

ipconfig /all > c:\temp1.txt

Will dump the result in C:\temp1.txt

$filename = "C:\temp1.txt"
$file = FileOpen($filename, 0)
If $file = -1 Then
    MsgBox(0, "Error", "Unable to open file.")
    Exit
EndIf
While 1
$line = FileReadLine($file)
If @error = -1 Then
;Do what you like...
EndIf
if StringInStr($line, "Subnet") <> 0 Then
;You've found the line with "Subnet" in it, so parse this as you like
EndIf
if StringInStr($line, "Gateway") <> 0 Then
;You've found the line with "Gateway" in it, so parse this as you like
EndIf
Wend

Something like that anyway, this is untested, so dont quote me on it.


Sitting comfortably behind the code.

Share this post


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
Sign in to follow this  
Followers 0