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-09 13:48
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [Help] Batch file for copying files, how to add pause View 866 Replies 6
Original Poster Posted 2008-08-23 15:16 ·  中国 广东 佛山 顺德区 电信
初级用户
Credits 44
Posts 21
Joined 2008-05-06 15:51
18-year member
UID 117903
Gender Male
Status Offline
I want to copy the contents of one folder to another folder, and pause after each file is copied. How can this be done with a batch file? (HAT already solved)

One more question: if I use the xcopy command, how can I pause after each folder is copied? I'm sincerely asking for advice, experts please help

[ Last edited by rjoe on 2008-8-23 at 05:36 PM ]
Floor 2 Posted 2008-08-23 15:20 ·  中国 重庆 九龙坡区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
Floor 3 Posted 2008-08-23 15:32 ·  中国 广东 佛山 顺德区 电信
初级用户
Credits 44
Posts 21
Joined 2008-05-06 15:51
18-year member
UID 117903
Gender Male
Status Offline
Oh, thanks. So it turns out do( can be split across lines after it!!!) I really need to study the for command properly
Floor 4 Posted 2008-08-23 16:38 ·  中国 广东 佛山 顺德区 电信
初级用户
Credits 44
Posts 21
Joined 2008-05-06 15:51
18-year member
UID 117903
Gender Male
Status Offline
One more question: why can't xcopy copy folders? In other words, how should the variable for folders under c:\test\aaa\ be set?
Floor 5 Posted 2008-08-23 19:46 ·  中国 重庆 九龙坡区 电信
版主
★★★★★
Credits 9,023
Posts 5,017
Joined 2007-05-31 19:39
19-year member
UID 89899
Gender Male
Status Offline
First take a look at xcopy's help
xcopy /?
Floor 6 Posted 2008-08-23 19:53 ·  中国 广东 佛山 电信
初级用户
Credits 44
Posts 21
Joined 2008-05-06 15:51
18-year member
UID 117903
Gender Male
Status Offline
xcopy source destination /E really can copy folders, but it won't pause. Is there any other parameter?
Floor 7 Posted 2008-08-23 20:02 ·  中国 广东 佛山 电信
初级用户
Credits 44
Posts 21
Joined 2008-05-06 15:51
18-year member
UID 117903
Gender Male
Status Offline
@echo off
for /f "delims=" %%a in ('dir/b/ad d:\test') do (
echo d| xcopy "d:\test\%%a" "c:\test\%%a" /e /s
pause
)

Done, if there are still problems please advise!

[ Last edited by rjoe on 2008-8-24 at 12:05 AM ]
Forum Jump: