legendchow - 2007-10-12 23:26:00
通用定时脚本
'在指定时间内执行具体的命令脚本,dotime 是执行时间,dosomething是执行的具体命令
'IsloopDo 是否循环执行,对于超过24小时不关机的机器,这项设置才有意义
'设为0 是到指定时间后执行完命令,脚本就退出,是1的话执行完命令后不退出
'继续等待到24小时后再次执行
'为降低脚本对系统资源的消耗,每隔30秒脚本才会检查一下时间
dotime = "16:20:26" '将会在这个时间执行命令,可以随意修改,是24小时,具体误差在1分钟内
dosomething = "shutdown -s" '具体执行的命令,可以是"d:\yy\cc.exe"这样的命令
IsLoopDo = 0 '是否重复执行命令,可以修改成1或0
Set WshShell = WScript.CreateObject("WScript.Shell")
doTime = TimeValue(dotime)
dohour=Hour(dotime)
dominute= Minute(dotime)
While 1
ntime = Now()
nHour = Hour(ntime)
nminute = Minute(ntime)
If (nhour = dohour and nminute = dominute ) Then
WshShell.Run dosomething
If(Not IsLoopDo) Then
wscript.quit
End If
wscript.sleep 80000
End If
wscript.sleep 30000
Wend
'测试系统当前日期如大于...就执行一个特定的程序.然后关闭VBS.
'如果时间小于就直接关闭VBS.
Set WshShell = Wscript.CreateObject("Wscript.Shell")
if date>"2005-12-30" then
WshShell.run "执行一个特定的程序.exe"
else
wscript.quit
end if
rem 创建文件夹
Set objFSO = CreateObject("Scripting.FileSystemObject")
ParentFolder = "D:\333\"
set objShell = CreateObject("Shell.Application")
set objFolder = objShell.NameSpace(ParentFolder)
If objFSO.FolderExists("D:\333\Desktop") Then
...
else
objFolder.NewFolder "Desktop"
End If
amuro2150 - 2007-10-13 12:46:00
看不懂... 以后得多多努力:default1:
faurecia - 2008-6-16 16:08:00
差距啊:default8: