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-02 20:32
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Recommendation] Teaching of Batch Processing View 78,281 Replies 303
Floor 301 Posted 2008-10-27 10:22 ·  中国 上海 电信
新手上路
Credits 18
Posts 23
Joined 2008-10-27 09:57
17-year member
UID 129206
Gender Male
Status Offline
I made a batch script that lets the user enter a number and then loops to create that number of folders, but I also want to share these folders and don't know how to do it. Here's the code:

@echo off
cd c:\
set name=0
set /p name="请输入机号:"
set t=name
for /l %%a in (1 1 %name%) do md %%a

First, for sharing folders in a batch script, you can use the `net share` command. You can modify the script like this:

@echo off
cd c:\
set name=0
set /p name="请输入机号:"
set t=name
for /l %%a in (1 1 %name%) do (
md %%a
net share "folder_%%a"=c:\%%a
)

This will create the folders and then share each one with the name "folder_序号". But note that you might need appropriate permissions to do the sharing.
Floor 302 Posted 2008-11-05 18:23 ·  中国 江苏 苏州 电信
新手上路
Credits 1
Posts 7
Joined 2008-10-22 20:20
17-year member
UID 129090
Gender Male
Status Offline
Good post
Recent Ratings for This Post ( 1 in total) Click for details
RaterScoreTime
yishanju -2 2008-11-05 18:30
Floor 303 Posted 2008-11-07 21:12 ·  中国 河南 郑州 联通
新手上路
Credits 18
Posts 20
Joined 2008-10-28 22:45
17-year member
UID 129408
Gender Male
Status Offline
Powerful
Floor 304 Posted 2008-11-29 12:37 ·  中国 上海 电信
初级用户
Credits 37
Posts 39
Joined 2007-12-07 22:44
18-year member
UID 105020
Gender Male
Status Offline
Good post
Recent Ratings for This Post ( 2 in total) Click for details
RaterScoreTime
HAT -4 2008-11-29 13:26
xhlcy0322 +1 2009-04-22 23:38
‹ Prev 1 19 20 21
Forum Jump: