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-11-24 04:34
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » Batch script to copy files every three minutes View 3,772 Replies 23
Floor 16 Posted 2007-03-13 05:47 ·  中国 重庆 电信
新手上路
★
Credits 10
Posts 5
Joined 2006-10-18 03:25
20-year member
UID 66226
Gender Male
Status Offline
Floor 17 Posted 2007-03-13 06:52 ·  中国 广东 广州 番禺区 电信
中级用户
★★
脚本爱好者
Credits 238
Posts 93
Joined 2007-03-11 13:38
19-year member
UID 81417
Gender Male
From GZ
Status Offline
Provide a VBS script as follows:

Const OverwriteExisting = True
Set objFSO = CreateObject("Scripting.FileSystemObject")
do
objFSO.CopyFile "c:\log\log.log" , "d:\logbak\log.log", OverwriteExisting
WScript.Sleep (1000*60*3) ' Delay for 3 minutes
loop


Copy the above code into Notepad, then save it as copy.vbs. Double-click this file to execute file copying in the background. Note that the D:\logbak directory must exist, otherwise an error will occur. To terminate, close the wScript.exe process.
Floor 18 Posted 2007-03-13 08:21 ·  中国 吉林 四平 联通
高级用户
★★★
Credits 859
Posts 413
Joined 2006-08-14 21:55
20-year member
UID 60532
Status Offline
The first sentence represents "Constant OverwriteExisting is True". But what does the first sentence mean is not quite clear?
Floor 19 Posted 2007-03-13 12:23 ·  中国 广东 广州 番禺区 电信
中级用户
★★
脚本爱好者
Credits 238
Posts 93
Joined 2007-03-11 13:38
19-year member
UID 81417
Gender Male
From GZ
Status Offline
First, create a constant named OverwriteExisting and set its value to True. Then use this constant to tell the FileSystemObject that it can overwrite the existing instance of the target file. The do...loop statement repeats the statement block when the condition is True or before the condition becomes True. Here, it repeats the CopyFile command.

[ Last edited by axi on 2007-3-13 at 07:40 AM ]
Floor 20 Posted 2009-05-26 02:23 ·  中国 江苏 盐城 大丰区 电信
新手上路
★
Credits 1
Posts 1
Joined 2009-05-25 12:11
17-year member
UID 145922
Gender Male
Status Offline
Let me download and try it
Floor 21 Posted 2009-05-26 07:07 ·  中国 天津 联通
初级用户
★
Credits 34
Posts 20
Joined 2006-10-15 08:57
20-year member
UID 65839
Status Offline
What the friend on the 4th floor said makes sense. It's really annoying to have a batch DOS window there. But you can use this method: convert the batch script of the friend on the 2nd floor into an EXE file using a DOS-to-EXE software, so that you don't need to see the DOS window. Personally, I think this is relatively perfect.
Floor 22 Posted 2009-05-26 11:51 ·  中国 河北 邯郸 魏县 联通
新手上路
★
Credits 17
Posts 10
Joined 2008-07-27 23:57
18-year member
UID 122220
Gender Male
Status Offline
Hehe, newbies, come and take a look.
Floor 23 Posted 2009-05-27 00:16 ·  中国 上海 浦东新区 电信
新手上路
★
Credits 13
Posts 4
Joined 2009-05-18 06:23
17-year member
UID 145365
Gender Male
Status Offline
Learning
Floor 24 Posted 2009-05-27 03:19 ·  中国 广东 电信
新手上路
★
Credits 1
Posts 1
Joined 2008-07-12 22:24
18-year member
UID 121430
Gender Male
Status Offline
Forum Jump: