Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords:
; Run Winipcfg and write output to txt. Will overwrite file each time. ; Stores txt in same location as this script RunWait("winipcfg.exe","/all /batch winipcfg.txt") fs = FileSize( "%windir%winipcfg.txt" ) binbuf = BinaryAlloc( fs ) BinaryRead( binbuf, "%windir%winipcfg.txt" ) ; ; Search for first occurrence of "IP Address. . . . . . . . . : 172." a = BinaryIndex( binbuf, 0, "IP Address. . . . . . . . . : 172", @FWDSCAN ) ; ; Search for first occurrence of "Default Gateway." ipAddr = BinaryIndex( binbuf, a, "Default Gateway", @FWDSCAN) ; ; Single out the actual Default Gateway from the line which contains "Default Gateway" string, ; skipping over the redundant first 32 characters. linebegin = BinaryIndex( binbuf, ipAddr, @CRLF, @BACKSCAN) + 32 ; ; Search for the end of the line which contains the "Default Gateway" string. lineend = BinaryIndex( binbuf, ipAddr, @CRLF, @FWDSCAN) linelen = lineend-linebegin+1 ; ; Extract the line with "Default Gateway" string. linedata=BinaryPeekStr(binbuf, linebegin, linelen) binbuf=BinaryFree(binbuf) Message("The Default Gateway is:", linedata)
Article ID: W14740
Filename: Run Winipcfg Write Output Parse Output.txt
File Created: 2001:03:13:16:38:12
Last Updated: 2001:03:13:16:38:12