| 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: 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 |
|