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-11 07:55
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Asking an expert to help write a batch file to add users in bulk with custom quantity and names View 692 Replies 5
Original Poster Posted 2009-02-09 00:03 ·  中国 广东 梅州 电信
新手上路
Credits 15
Posts 10
Joined 2007-10-26 02:03
18-year member
UID 100802
Gender Male
Status Offline
Batch file for adding users in bulk:
FOR /L %%i in (1,1,30) DO NET USER abc%%i 123456 /ADD

The above can only add a fixed quantity, prefix, and password.
Can it be changed so the above content can be entered manually?
That is, after running the batch file, manually enter the number of users to add ==
Floor 2 Posted 2009-02-09 00:12 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
Like this?

set/p sl=Please enter the number of users to add:
FOR /L %%i in (1,1,%sl%) DO NET USER abc%%i 123456 /ADD
Floor 3 Posted 2009-02-09 01:42 ·  中国 广东 梅州 电信
新手上路
Credits 15
Posts 10
Joined 2007-10-26 02:03
18-year member
UID 100802
Gender Male
Status Offline
Yes, can all 3 parameters be made like this?
Number of users, username prefix, user password
Floor 4 Posted 2009-02-09 01:44 ·  中国 广东 梅州 电信
新手上路
Credits 15
Posts 10
Joined 2007-10-26 02:03
18-year member
UID 100802
Gender Male
Status Offline
At the moment I use it like this:

FOR /L %%i in (1,1,30) DO NET USER abc%i 123456 /ADD
FOR /L %%i in (1,1,30) DO net localgroup administrators abc%i /add

First add 30 users, then add all 30 users to the administrators group
Thanks to the moderator for the help
Floor 5 Posted 2009-02-09 11:25 ·  中国 四川 南充 电信
超级版主
★★★★
我爱DOS
Credits 5,310
Posts 2,044
Joined 2005-09-26 12:00
20-year member
UID 42843
Gender Male
From 四川南充
Status Offline
All of that is possible!
set/p sl=Please enter the number of users to add:
FOR /L %%i in (1,1,%sl%) DO NET USER abc%%i 123456 /ADD
FOR /L %%i in (1,1,%sl%) DO net localgroup administrators abc%%i /add
Floor 6 Posted 2009-02-09 22:42 ·  中国 广东 梅州 电信
新手上路
Credits 15
Posts 10
Joined 2007-10-26 02:03
18-year member
UID 100802
Gender Male
Status Offline
Can the username prefix and password be added too?
Forum Jump: