Making a batch file to change IP address of all connections.

January 31, 2012 at 00:01:23
Specs: Windows XP
I want to make a batch that can change the IP address of all the connections present in "Network Connections".Also tell me if there is any difference in the code for different versions of windows. I am a newbie and thus also provide tips.

See More: Making a batch file to change IP address of all connections.

Report •

January 31, 2012 at 03:20:10
Best software to hide ip:

Video here:

Report •

January 31, 2012 at 11:18:50
For what purpose? What do you hope to achieve by mass changing of IP addresses.

If it some attempt at security you are barking up the wrong tree.

The link posted in post #1 wont do you any good as that is for your public IP address and even that has doubtful use. Network connections are private addresses.


Report •

February 1, 2012 at 03:31:02
I am not trying to violate anyone's security. My friends connect via dial-up connections. i am making a site that has access to the computers which have the given IP. thus prohibiting any other from accessing my site.

I know, it could be done manually also, but that would require some work. using batch files, only a click could do the whole thing.

And, this file is not to be spread as a virus, it would have a password.

Report •

Related Solutions

February 1, 2012 at 03:33:22
I dont want a software. i just want a batch program.

Report •

February 1, 2012 at 05:07:01
I am not suggesting that you are trying to violate any else's security. I was suggesting that you might be thinking of improving you own security.

IP addresses play no part in security and by restricting access to a particular IP addresses you are just making things more difficult for your self.

If you are behind a router no one can access you internal network unless you allows it. The is usually done by port forwarding on the router. It is the public IP address that external connections see and nothing else. Messing about with internal network IP addresses achieves absolutely nothing at all.


Report •

February 5, 2012 at 07:15:55
If still interested in changing IP addresses, I banged this out using WMIC:


:: Set to the local network and accompanying subnet mask. Also set a filter ::
:: to optionally protect adapters that are DHCP enabled. This is determined ::
:: by which "SET filter" statement is found *LAST*. Adjust accordingly!     ::
SET network=192.168.0
SET subnet_mask=
SET filter="IPEnabled=TRUE AND DHCPEnabled=FALSE"
SET filter="IPEnabled=TRUE"

:: Loop through all adapters that are at least IP enabled, and get it's     ::
:: index number for reference later on. Next, create a random number        ::
:: between 1 and 254 to prevent selecting the "network" address and         ::
:: "broadcast" address as the host address. PING is then used to verify     ::
:: the generated host node is not already found on the network. If it is,   ::
:: a new number is generated and tested again. Finally, call the Update_Ip  ::
:: routine to do the actual work of changing the IP address for the         ::
:: selected adapter, using the two variables found or randomly created.     ::
FOR /F "tokens=2 delims==" %%A IN ('WMIC nicconfig WHERE %filter% GET INDEX /FORMAT:LIST') DO (
    SET /A host=!RANDOM! %%254+1
    FOR /F "tokens=10 delims= " %%B IN ('PING -n 1 -w 500 %network%.!host!^|FINDSTR /I "PACKETS"') DO (
        IF /I %%B EQU 1 (
            CALL :Update_IP %%A !host!
        ) ELSE (
            ECHO Duplicate IP address generated: %network%.!host!
            GOTO :Get_host

:: Routine to set the adapter. For clarity and readability, variables are   ::
:: set to the two arguments passed to the routine. WMIC is then called,     ::
:: using the index to properly select the correct adapter. The Enablestatic ::
:: method is used to update the adapter to the new setting.                 ::
SET index=%1
SET host=%2
WMIC nicconfig WHERE INDEX="%index%" CALL Enablestatic("%network%.%host%"),("%subnet_mask%")

When your only tool is a hammer, every problem looks like a nail.

Report •

Ask Question