Board logo

标题: 怎样把一个文件拷贝到所有目录?? [打印本页]

作者: zhxy9804     时间: 2008-3-8 17:14    标题: 怎样把一个文件拷贝到所有目录??
比如要把c盘的1.txt 拷贝到D盘所有的文件夹里,命令应该怎样写?
删除d盘所有的1.txt我倒是知道
:
d:
del /s 1.txt

作者: fastslz     时间: 2008-3-8 17:46
for /r D: %i in (.) do xcopy /h/r/y "c:\1.txt" "%i"

作者: fmr520     时间: 2008-3-9 10:29
Originally posted by fastslz at 2008-3-8 17:46:
for /r D: %i in (.) do xcopy /h/r/y "c:\1.txt" "%i"


要改成
for /r D: %%i in (.) do xcopy /h/r/y "c:\1.txt" "%%~fi"

作者: zhxy9804     时间: 2008-3-9 16:31
到底谁的对啊?
二楼的真的达到了要求的

作者: haiou327     时间: 2008-3-9 19:50
达到要求就是对的!!!!!!!!!!!!!!