中国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-11-11 06:14
47,815 topics / 349,930 posts / today 0 new / 48,291 members
DOS批处理 & 脚本技术(批处理室) » Copy a file to many folders (with a pattern)
Printable Version  5,394 / 21
Floor16 beyoungse Posted 2007-01-07 13:15
中级用户 Posts 112 Credits 253
I replaced copy with xcopy /i /s/e
Floor17 dikex Posted 2007-01-07 13:17
高级用户 Posts 366 Credits 788
xcopy /i /s /e "Documents and Settings" "%name%"
Floor18 beyoungse Posted 2007-01-07 13:21
中级用户 Posts 112 Credits 253
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


……
……
……
Floor19 dikex Posted 2007-01-07 13:25
高级用户 Posts 366 Credits 788
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..."
Floor20 beyoungse Posted 2007-01-07 13:33
中级用户 Posts 112 Credits 253
@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
Floor21 jmz573515 Posted 2007-03-14 08:02
银牌会员 Posts 464 Credits 1,212
For learning, there are inevitable mistakes. Thanks for correction!
Floor22 handan Posted 2007-11-24 15:04
初级用户 Posts 12 Credits 30
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
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023