China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-07 00:58
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » How to randomize from 0 to 255 View 696 Replies 4
Original Poster Posted 2007-12-26 21:55 ·  中国 陕西 西安 电信
初级用户
Credits 40
Posts 14
Joined 2007-03-04 23:41
19-year member
UID 80781
Gender Male
Status Offline
An IP range, how to randomize from 0 to 255

Display a random IP range
Floor 2 Posted 2007-12-26 21:59 ·  中国 广西 南宁 电信
初级用户
★★
Credits 127
Posts 59
Joined 2007-11-13 00:41
18-year member
UID 102491
Gender Female
Status Offline
@echo off
set "a=%random%%%226"
ping 192.168.132.%a%

Is that what you mean?
Floor 3 Posted 2007-12-27 16:45 ·  中国 北京 联通
银牌会员
★★★
Credits 1,287
Posts 634
Joined 2007-05-02 15:06
19-year member
UID 87277
Gender Male
From cmd.exe
Status Offline
The poster above... should be %%256, right
Floor 4 Posted 2007-12-27 23:02 ·  中国 广西 南宁 电信
初级用户
★★
Credits 127
Posts 59
Joined 2007-11-13 00:41
18-year member
UID 102491
Gender Female
Status Offline
Sorry, typo. Thanks for pointing it out!
Floor 5 Posted 2007-12-28 12:53 ·  中国 广西 南宁 电信
初级用户
★★
Credits 127
Posts 59
Joined 2007-11-13 00:41
18-year member
UID 102491
Gender Female
Status Offline
set /a "a=%random%%%256" randomly displays 0-255
set /a "a=%random%%%255+1" randomly displays 1-255


What I wrote above was wrong sorry about that I'm just learning too...
Forum Jump: