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-06-20 06:13
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Copy a file to many folders (with a pattern) View 4,481 Replies 21
Floor 16 Posted 2007-01-07 13:15 ·  中国 广东 深圳 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
I replaced copy with xcopy /i /s/e
Floor 17 Posted 2007-01-07 13:17 ·  中国 广东 广州 天河区 电信
高级用户
★★★
潜水修练批处理
Credits 788
Posts 366
Joined 2006-12-31 02:43
19-year member
UID 75048
Gender Male
Status Offline
xcopy /i /s /e "Documents and Settings" "%name%"
Floor 18 Posted 2007-01-07 13:21 ·  中国 广东 深圳 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
C:\Documents and Settings\MM\test>copy.bat

C:\Documents and Settings\MM\test>for /L %i in (1 1 10) do call :copy_ %i

C:\Documents and Settings\MM\test>call :copy_ 1

C:\Documents and Settings\MM\test>set num=001

C:\Documents and Settings\MM\test>set name=a001

C:\Documents and Settings\MM\test>xcopy /i /s/e C:\Documents and Settings\MM\test\D
ocuments and Settings\ a001
Invalid number of parameters


……
……
……
Floor 19 Posted 2007-01-07 13:25 ·  中国 广东 广州 天河区 电信
高级用户
★★★
潜水修练批处理
Credits 788
Posts 366
Joined 2006-12-31 02:43
19-year member
UID 75048
Gender Male
Status Offline
Please clarify the content that needs to be translated. The provided text "看清楚17楼,路径是被双引号包住的……" needs to be translated. The translation is: "Please see the 17th floor, the path is enclosed in double quotes..."
Floor 20 Posted 2007-01-07 13:33 ·  中国 广东 深圳 电信
中级用户
★★
Credits 253
Posts 112
Joined 2005-12-20 00:31
20-year member
UID 47500
Status Offline
@echo off
for /l %%i in (1,1,100) do call :copy_ %%i
goto :eof

:copy_
set num=00%1
set name=a%num:~-3%
xcopy /I /e/s "Documents and Settings" %name%
goto :eof
Floor 21 Posted 2007-03-14 08:02 ·  中国 辽宁 本溪 联通
银牌会员
★★★
Credits 1,212
Posts 464
Joined 2006-12-13 21:11
19-year member
UID 73417
Gender Male
Status Offline
For learning, there are inevitable mistakes. Thanks for correction!

@echo off
setlocal EnableDelayedExpansion
for /l %%a in (1,1,100) do (
set a=00%%a
@echo bak !a:~-3!
)
pause>nul
Floor 22 Posted 2007-11-24 15:04 ·  中国 河北 邯郸 电信
初级用户
Credits 30
Posts 12
Joined 2007-10-19 18:07
18-year member
UID 100183
Gender Male
Status Offline
I'm just starting to learn batch processing. I thought like this
Don't laugh at me
@echo off & setlocal EnableDelayedExpansion
set var=000
for /l %%i in (1 1 100) do (
set var=%var%%%i
set var=!var:~-3!
if not exist a!var! md a!var!
copy bak a!var!
)
pause
Forum Jump: