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-13 04:13
中国DOS联盟论坛 » DOS学习入门 & 精彩文章 (教学室) » What DOS command copies a file to all subdirectories under a root directory View 668 Replies 2
Original Poster Posted 2004-01-27 00:00 ·  中国 北京 联通
初级用户
Credits 180
Posts 20
Joined 2002-10-25 00:00
23-year member
UID 61
Gender Male
Status Offline
What is the DOS command to copy a file to all subdirectories under a root directory?

COPY FILENAME /???

What parameter should be added?


Floor 2 Posted 2004-01-30 00:00 ·  中国 湖北 武汉 电信
初级用户
Credits 105
Posts 1
Joined 2004-01-30 00:00
22-year member
UID 16322
Gender Male
Status Offline
What parameter should be added??
Floor 3 Posted 2004-01-30 00:00 ·  中国 黑龙江 哈尔滨 联通
初级用户
Credits 188
Posts 25
Joined 2003-08-13 00:00
23-year member
UID 8532
Gender Male
Status Offline
If you don't need the subdirectories under those subdirectories, you can do this:
for %f in (*.*) copy FILENAME %f\NEWNAME
If you do need that, then:
dir *. /b/s>1.bat
Then edit it yourself in WPS, search for "^P^M", replace it with "^P^Mcopy FILENAME " (note the space)
Then adjust the first line and the last line yourself
————————————
做一颗永不生锈的螺丝帽!
————————————
Forum Jump: