WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

TCPIP and IP Address

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

NT 4.0 IP Address Translation

Keywords: 

Question:

Step 1: Retrieve input from user for IP Address (ie - 192.168.0.20)

Step 2: Want to merge this new information into the registry to set the IP address

Problem: It is a binary value in registry (being represented in hex). I tried pushing the value as a string (as suggested on one of the articles on the WinBatch Tech Support web page). This did not work - Do I need to convert this value to binary, hex? If so - how do I do it - or is there an easier way around this issue (which I'm sure many have already encountered)?

Answer:

1)
ip="192.168.0.20"
ip1=ItemExtract(1,ip,".")
ip2=ItemExtract(2,ip,".")
ip3=ItemExtract(3,ip,".")
ip4=ItemExtract(4,ip,".")
AddExtender("wilx34I.dll")
ip1=xBaseConvert(ip1,10,16)
ip2=xBaseConvert(ip2,10,16)
ip3=xBaseConvert(ip3,10,16)
ip4=xBaseConvert(ip4,10,16)
ip1=strfixleft(ip1,0,2)
ip2=strfixleft(ip2,0,2)
ip3=strfixleft(ip3,0,2)
ip4=strfixleft(ip4,0,2)

hexaddr=strcat(ip1," ",ip2," ",ip3," ",ip4)
Message(ip,hexaddr)
2)
RegSetBin

Article ID:   W14407
Filename:   NT 4.0 IP Address Translation.txt
File Created: 2001:03:01:12:17:00
Last Updated: 2001:03:01:12:17:00