1.

Solve : how to change your IP with a batch file??

Answer»

So I would really like to know how to change my IP with a batch FILE. I know about Netsh.exe and IPConfig but they don't seem to do anything? I probably not using them right can some one show me how to do this? I also would to say hey and thanks for the quick reply earlier. Big Help!!! NETSH should be able to do it for you. What do you want to change it to? Here is the command line to change it to 192.168.1.100/24 with a gateway of 192.168.1.1 and a metric of 1:
Code: [Select]netsh int ip set address name="Local AREA Connection" source=static 192.168.1.100 255.255.255.0 192.168.1.1 1Tried it but it still does nothing so to see if it changed I type ipconfig but it's the same as it was. Why do you want to change your IP?

What sort of network connection do you have? Are you on a LAN, wired or otherwise, a DSL modem, a cable modem? Because, depending on what kind of connection you have, it may not be possible to change your IP address in the way that you envisage. In connection with this, you could type "DHCP explained" into Google.



Do you have just one network card? Is the network card you want to change called "Local Area Connection"? Post the results of your IPCONFIG and we'll see what we can figure out.Well theres not really one reason. just allot of little ones basically I just want to know all that there is to know. I already know C++, Visual Basic, C#, Java, HTML, PHP, Assembly, Max Script, Maya Mel Script and etc. and also I'm using a cable modem with a wireless linksys router and here is the output:

Windows IP Configuration


Ethernet adapter Hamachi:

Connection-specific DNS Suffix . :
IP Address. . . . . . . . . . . . : 5.152.11.87
Subnet Mask . . . . . . . . . . . : 255.0.0.0
Default Gateway . . . . . . . . . :

Ethernet adapter Wireless Network Connection:

Connection-specific DNS Suffix . : triad.rr.com
IP Address. . . . . . . . . . . . : 192.168.1.102
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1

Quote from: BlazingClaymore on May 25, 2007, 02:55:35 AM

I already know C++, Visual Basic, C#, Java, HTML, PHP, Assembly, Max Script, Maya Mel Script and etc.

Wow! You know all that, and you're stumped by a little thing like changing your IP in a batch file?

Have you tried etc++ ?



you can use vbscript
Code: [Select]Set Adapters=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2").ExecQuery("select * from Win32_NetworkAdapterConfiguration where IPEnabled=true")
IPArray = Array("192.168.1.100")
MaskArray = Array("255.255.255.0")
GatewayArray = Array("192.168.1.1")
GatewayMetric = Array(1)
For each NIC in Adapters
NIC.EnableStatic IPArray, MaskArray
NIC.SetGateways GatewayArray, Gatewaymetric
Next
The reason my initial post didn't change your IP address is because I assumed your computer was using the default adapter name. For your case, if you want to change the IP address of your wireless card, the command line to change it to 192.168.1.100/24 with a gateway of 192.168.1.1 and a metric of 1:
Code: [Select]netsh int ip set address name="Wireless Network Connection" source=static 192.168.1.100 255.255.255.0 192.168.1.1 1Or for your other (Hamachi) card, the code would be:
Code: [Select]netsh int ip set address name="Hamachi" source=static 192.168.1.100 255.255.255.0 192.168.1.1 1Dah! why didn't I think about it like that. well the main reason why I don't know this stuff is because I've never had the internet before but now I do. I'm also learning sock PROGRAMING with C++ now. For some reason my internet connection gets messed up when I change my IP. what can the problem be? I had to unplug every thing then plug it all back in.Your internet connection uses your IP address. Why are you changing it? And what are you changing it from and to?I don't know but I think it may have SOMETHING to do with DNS thing? because its empty when it doest work. Try adding this as the following line in your batch file (change the adapter name and IP adress for your needs):
Code: [Select]netsh interface ip set dns "Hamachi" static 192.168.1.1


Discussion

No Comment Found