Add Multiple IP Addresses to a Windows Server From the Command Line

Say you want to add 192.168.1.2 through to 192.168.1.14 with a /28 netmask (255.255.255.240).

for /L %a in (2,1,14) do netsh in ip add address "Local Area Connection" 192.168.1.%a 255.255.255.240

Which is:
for /L (tell for that it's a range of numbers)
%a in (placeholder variable)
(start, step, end) (self explanatory)
do (command goes here)

This page FOR /L has more detail and is part of this very useful site ss64.com

Comments

Popular posts from this blog

YumRepo Error: All mirror URLs are not using ftp, http[s] or file

Linux: Permanent CIFS/SMB mount

Plesk - Decrypt FTP Passwords