中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-23 12:23
47,812 topics / 349,917 posts / today 0 new / 48,273 members
DOS批处理 & 脚本技术(批处理室) » [Recommendation] Teaching of Batch Processing
Printable Version  80,755 / 303
Floor301 ymqq2003 Posted 2008-10-27 10:22
新手上路 Posts 23 Credits 18
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.
Floor302 aprilus Posted 2008-11-05 18:23
新手上路 Posts 7 Credits 1
Good post
Floor303 wishpopo Posted 2008-11-07 21:12
新手上路 Posts 20 Credits 18
Powerful
Floor304 5551551 Posted 2008-11-29 12:37
初级用户 Posts 39 Credits 37
Good post
Prev  118 19 20 21
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023