adding IP address to IPv4

Post your working scripts, libraries and tools for AHK v1.1 and older
wsimon98
Posts: 7
Joined: 29 Oct 2018, 20:26

adding IP address to IPv4

21 Nov 2018, 04:22

I needed to do this for work... Combed all of the forums, and put this together.

Code: Select all

#SingleInstance

Menu, Tray, Icon, Shell32.dll, 150 ;this is simply just to have a system tray icon while running, its not necessary
^#s:: ;the shortcut key to make it run after double clicking on the exe
run CMD.exe
Loop, read, C:\example.txt
{
    Loop, parse, A_LoopReadLine, %A_Tab%
    {
			sleep, 500
            Send netsh interface ipv4 add address %A_LoopField% {enter}
    }
}

Esc::ExitApp
It does need to be accompanied by a .txt file that includes the "local network name" (name of the adapter you want to add to), the IPs you want to add, and the subnet mask of those IPs.

A txt file like this:

Code: Select all

TEST 1.0.0.1 255.255.255.0
TEST 1.0.0.2 255.255.255.0
TEST 1.0.0.3 255.255.255.0
TEST 1.0.0.4 255.255.255.0
TEST 1.0.0.5 255.255.255.0
Very simple I guess, but very practical.

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: gwarble, Xtra and 108 guests