tags:

views:

52

answers:

2

I want to write a program that will reset a user's Local Area Network / (TCP/IP) Properties.

Here's what I do manually (which I want to program to do automatically):

1) START -> Run -> cmd (get command prompt)
2) ipconfig /release
3) START -> Connect to -> Show all connections
4) Right-click "Local Area Network" and click "Properties"
5) Highlight "Internet Protocol (TCP/IP) and click "Properties"
6) Check box "Use the following IP Address"
7) Enter "111.111.111.111" for IP address
8) Enter "255.0.0.0" for Subnet mask
9) Click OK, and Close.
10) Wait 20 seconds
11) START -> Connect to -> Show all connections
12) Check box for "Obtain IP address automatically"
13) Click OK, and close.
14) Wait 20 seconds.

I want to do above 14 steps via my java program.How do i do it?Are there any api that allows me to set the above paramarers.The chnages must be saved and should remain even when i restart my pc.I want the pragram to run only once and not eveery time when i start my pc.

+1  A: 

You appear to be trying to renew your IP address using DHCP.

Instead of writing a Java program, write the following batch file:

ipconfig /renew
SLaks
You're not really answering his question. I am sure OP considered that, he needs java for specific tasks.
vehomzzz
I don't think the OP considered this. As the OP appears to want a program that just does this, I don't think that he needs to use Java.
SLaks
A: 

Only through Runtime.exec (as SLaks mentioned) or using JNI. There is no native JAVA library which is capable of handling this issue as far as i know.

dz