script for increase ip

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
techsitepoint
Posts: 1
Joined: 20 Nov 2010 03:24

script for increase ip

#1 Post by techsitepoint » 20 Nov 2010 03:36

Hello.


I need a cmd script for increase ip, for example, if I have 192.168 .1.1 in a IP variable I need calculate 3 ip more, 192.168.1.4, in cmd, no vbs or similar.

Thanks

Example:

SET IP=192.168.1.1

I need calculate 192.168.1.4 , for example

Thanks

!k
Expert
Posts: 378
Joined: 17 Oct 2009 08:30
Location: Russia

Re: script for increase ip

#2 Post by !k » 20 Nov 2010 11:25

Code: Select all

@echo off
setlocal enableextensions enabledelayedexpansion
SET IP=192.168.1.1
for /f "tokens=1-4 delims=." %%a in ("%IP%") do (
set /a ddd = %%d + 3
SET newIP=%%a.%%b.%%c.!ddd!
echo !newIP!
)
pause

Post Reply