|
yishu
新手上路

积分 10
发帖 2
注册 2006-2-23
状态 离线
|
『楼 主』:
[已结]每隔三分钟拷贝文件的批处理
使用 LLM 解释/回答一下
我想在dos下用批处理实现每隔三分钟拷备c:\log\log.log到d:\logbak\log.log
应该如何实现!
───────────────── 版务记录 ─────────────────
执行:Will Sort
操作:修改标题:《19227 - 问个超高难的问题!》
处罚:因属论坛新人,不予积分处罚
提示:请访问 {7326}论坛新手必读,所有人的基本行为准则
───────────────── 版务记录 ─────────────────
Last edited by willsort on 2006-3-30 at 15:44 ]
I want to use batch processing under DOS to copy c:\log\log.log to d:\logbak\log.log every three minutes. How to achieve it!
───────────────── Moderation Record ─────────────────
Performed by: Will Sort
Operation: Modify title: "19227 - Asking a super difficult question!"
Punishment: No points punishment as it's a new forum user
Prompt: Please visit {7326}Forum Newcomer Must-Read, Basic Code of Conduct for Everyone
───────────────── Moderation Record ─────────────────
Last edited by willsort on 2006-3-30 at 15:44 ]
|
|
2006-2-23 07:15 |
|
|
tigerpower
中级用户
   大师兄
积分 377
发帖 99
注册 2005-8-26
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
使用 sleep :
@echo off
:cycle
copy /y c:\log\log.log d:\logbak\log.log
sleep 180
goto cycle
Using sleep :
@echo off
:cycle
copy /y c:\log\log.log d:\logbak\log.log
sleep 180
goto cycle
附件
1: sleep.zip (2006-2-23 18:55, 7.49 KiB, 下载附件所需积分 1 点
,下载次数: 74)
|
|
2006-2-23 18:55 |
|
|
weilong888
银牌会员
    
积分 1270
发帖 548
注册 2004-5-31
状态 离线
|
|
2006-2-23 19:30 |
|
|
JonePeng
金牌会员
      D◎$ Fαп
积分 4562
发帖 1883
注册 2004-1-19 来自 广东广州
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
2楼的程序的缺点是不能实现后台复制,好像还不是符合楼主的要求哦 <img src="images/smilies/face-raspberry.png" align="absmiddle" border="0">
我觉得楼主的目标应该设计一个这样的程序:调用中断处理,常驻内存,实时监控,后台复制,并且能继续运行其它程序。这类似于Windows的计划任务。批处理很难做到,C语言就可以。
Last edited by JonePeng on 2006-2-23 at 20:56 ]
The disadvantage of the program on the 2nd floor is that it cannot achieve background copying, which doesn't seem to meet the LZ's requirements, oh :P
I think the LZ's goal should be to design such a program: call interrupt handling, reside in memory, monitor in real time, copy in the background, and be able to continue running other programs. This is similar to Windows' Task Scheduler. Batch processing is difficult to do, but C language can.
Last edited by JonePeng on 2006-2-23 at 20:56 ]
|

----====≡≡≡≡ 我的至爱,永远是MSDOS!≡≡≡≡====----
|
|
2006-2-23 20:55 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
@echo off
copy c:\log\log.log d:\logbak\log.log
set mytime=%time:~3,2%
set wintime=%time:~0,3%
:t
set /A mytime+=3
if "%mytime%" GTR 60 set /A mytime-=60
if "%mytime%" =="60" set /A mytime=00
:m
set times=%time:~0,5%
set ti=%times:~3%
if "%ti%"=="00" set wintime=%time:~0,3%
if "%wintime%%mytime%"=="%times%" copy c:\log\log.log d:\logbak\log.log && goto t
goto m
Last edited by doscc on 2006-3-27 at 22:00 ]
@echo off
copy c:\log\log.log d:\logbak\log.log
set mytime=%time:~3,2%
set wintime=%time:~0,3%
:t
set /A mytime+=3
if "%mytime%" GTR 60 set /A mytime-=60
if "%mytime%" == "60" set /A mytime=00
:m
set times=%time:~0,5%
set ti=%times:~3%
if "%ti%" == "00" set wintime=%time:~0,3%
if "%wintime%%mytime%" == "%times%" copy c:\log\log.log d:\logbak\log.log && goto t
goto m
Last edited by doscc on 2006-3-27 at 22:00 ]
|
|
2006-3-27 19:05 |
|
|
chenall
银牌会员
    
积分 1276
发帖 469
注册 2002-12-23 来自 福建泉州
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
我也来贴一个
@echo off
:start
copy /y c:\log\log.log d:\logbak\log.log
choice /T 180 /d y
goto start
I also post one
@echo off
:start
copy /y c:\log\log.log d:\logbak\log.log
choice /T 180 /d y
goto start
|

QQ:366840202
http://chenall.net |
|
2006-3-27 23:16 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
这么好用的命令 choice
可是在我的XP 里的 cmd 没有这个命令啊
不知道为什么?
在2003就有
Such a useful command choice
But the cmd in my XP doesn't have this command.
I don't know why?
It's available in 2003
|
|
2006-3-28 22:51 |
|
|
Climbing
铂金会员
       网络独行侠
积分 6962
发帖 2753
注册 2003-4-16 来自 河北保定
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
复制一个过去就行了,choice好象有两个版本。
Just copy it over. Choice seems to have two versions.
|

偶只喜欢回答那些标题和描述都很清晰的帖子!
如想解决问题,请认真学习“这个帖子”和“这个帖子”并努力遵守,如果可能,请告诉更多的人!
|
|
2006-3-28 23:30 |
|
|
3742668
荣誉版主
      
积分 2013
发帖 718
注册 2006-2-18
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
XP直接就用ping好了
ping 1.1.1.1 -w 3000 -n 1
设定n的次数为1次,可尽量地使时间精确。
For XP, just use ping.
ping 1.1.1.1 -w 3000 -n 1
Set the number of times n to 1, which can make the time as precise as possible.
|
|
2006-3-29 00:51 |
|
|
kingchain
初级用户
 
积分 133
发帖 57
注册 2006-3-15
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
Originally posted by chenall at 2006-3-27 23:16:
我也来贴一个
@echo off
:start
copy /y c:\log\log.log d:\logbak\log.log
choice /T 180 /d y
goto start
j此方法好!
请问你的 {copy to slip}怎么搞的啊?想学<img src="images/smilies/face-raspberry.png" align="absmiddle" border="0">
Last edited by kingchain on 2006-3-29 at 11:07 ]
Originally posted by chenall at 2006-3-27 23:16:
I'll also post one
@echo off
:start
copy /y c:\log\log.log d:\logbak\log.log
choice /T 180 /d y
goto start
This method is good!
May I ask how you do the {copy to slip}? I want to learn it :P
Last edited by kingchain on 2006-3-29 at 11:07 ]
|
|
2006-3-29 11:06 |
|
|
chenall
银牌会员
    
积分 1276
发帖 469
注册 2002-12-23 来自 福建泉州
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
加code代码
例子:
[code]
@echo off
:start
copy /y c:\log\log.log d:\logbak\log.log
choice /T 180 /d y
goto start
[/code]
Add code code Example:
@echo off
:start
copy /y c:\log\log.log d:\logbak\log.log
choice /T 180 /d y
goto start
|

QQ:366840202
http://chenall.net |
|
2006-3-29 17:07 |
|
|
doscc
中级用户
  
积分 256
发帖 93
注册 2006-3-26 来自 广东
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
请问 chenall
"" 的作用是什么?
----------------------------------------
哦知道了.
Last edited by doscc on 2006-3-29 at 17:37 ]
What is the function of ""?
----------------------------------------
Oh, I got it.
Last edited by doscc on 2006-3-29 at 17:37 ]
|
|
2006-3-29 17:33 |
|
|
warmoon
初级用户
 
积分 40
发帖 13
注册 2006-3-11 来自 浙江温州曾在宁波
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
Originally posted by JonePeng at 2006-2-23 20:55:
2楼的程序的缺点是不能实现后台复制,好像还不是符合楼主的要求哦 :P
我觉得楼主的目标应该设计一个这样的程序:调用中断处理,常驻内存,实时 ...
那我是菜菜鸟,pengpeng能不能传个C的样本上来我:P好好学学?谢谢阿!
那我是菜菜鸟,pengpeng能不能传个C的样本上来我:P好好学学?谢谢阿!
那 I'm a newbie, can pengpeng upload a C sample for me to learn from :P? Thanks ah!
|
|
2006-4-4 10:35 |
|
|
pizigao
银牌会员
     三生缘里笑红尘
积分 1063
发帖 292
注册 2003-3-9
状态 离线
|
|
2006-4-9 01:00 |
|
|
fpqcj
新手上路

积分 7
发帖 4
注册 2007-1-23
状态 离线
|
『第 15 楼』:
都是高手,学习学习呀!!!
使用 LLM 解释/回答一下
都是高手,学习学习呀!!!
They are all experts, let's study!
|
|
2007-3-12 00:53 |
|