You might try this to get the information you need. WMI seems easier to use for me

break on

$IpSet = GetObject("winmgmts:").ExecQuery("select DefaultIPGateway from Win32_NetworkAdapterConfiguration where IPEnabled=TRUE")

IF @error <> 0
? @error + " / " @serror
else
For Each $IPConfig In $IPSet

$GATEWAY = $IPConfig.DefaultIPGateway(0)

Next
EndIf