dos 复制修改时间为当天的文件

zjwtnt 2008-02-16 01:13:54
如题,

我要做一个BAT.将修改时间为当天的文件复制到某个文件夹下..

大家帮帮忙
...全文
297 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
thomasshupeng 2008-02-18
  • 打赏
  • 举报
回复
sorry, missing a "." and the "NOT" in the 2nd line. :(
Here is the update version.
--------------------------------------------------------------

@echo off
IF NOT DEFINED %2. goto usage

Xcopy /S /D:%date:~0,2%-%date:~3,2%-%date:~6,4% %1 %2
@echo Done!
goto Ending

:usage
@echo Usage:backup2day.bat SourceDir DistinationDir

:Ending
@echo //////////////////////////////////////////
@echo Thank you for using this tool!
@echo Good Luck!
@echo //////////////////////////////////////////
@echo on
thomasshupeng 2008-02-18
  • 打赏
  • 举报
回复
@echo off
if DEFINED %2 goto Usage
Xcopy /S /D:%date:~0,2%-%date:~3,2%-%date:~6,4% %1 %2
@echo Done!
goto Ending
:Usage
@echo //////////////////////////////////////////
@echo Usage:backup2day.bat SourceDir DistinationDir
@echo //////////////////////////////////////////
:Ending
@echo //////////////////////////////////////////
@echo Thank you for using this tool!
@echo Good Luck!
@echo //////////////////////////////////////////
@echo on
ljc007 2008-02-17
  • 打赏
  • 举报
回复
先把你的日期格式贴出来看看,否则别人写的批处理很可能在你电脑上无法正常运行。

[code=BatchFile]echo %date%[/code]
lik99 2008-02-16
  • 打赏
  • 举报
回复
@echo off
xcopy c:\1\*.* d:\2 /d:02-16-2008
pause

这是将C:\1\下今天修改的文件拷贝到D:\2下面,当然后面那个日期是要设成当天的日期

6,871

社区成员

发帖
与我相关
我的任务
社区描述
Windows 2016/2012/2008/2003/2000/NT
社区管理员
  • Windows Server社区
  • qishine
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧