Extending on James T's solution, here is a batch script:
something.cmd
FOR /L %G IN (50, 1, 100) DO ECHO %G 192.168.1.2 %G >> hi.txt
Explanation:
- 50 is the starting number
- 1 is the step for every loop
- 100 is the end number
If you want to "move" the port range on the destination (ex: 50-100 on source, 100-150 on destination) use this batch script:
setlocal ENABLEDELAYEDEXPANSION
FOR /L %%G IN (50, 1, 100) DO (
set /a dest=%%G+50
ECHO %%G 192.168.1.2 !dest! >> hi.txt)
The line set /a dest=%%G+50
sets your distance from the source ports.
If you want a longer, but easier to maintain script:
@echo off
setlocal ENABLEDELAYEDEXPANSION
set start=150
set step=5
set end=200
set destdistance=-50
set ip=192.168.1.2
set outputfile=output.txt
FOR /L %%G IN (%start%, %step%, %end%) DO (
set /a dest=%%G%destdistance%
ECHO %%G %ip% !dest! >> %outputfile%)