编辑以下脚本,检查系统时间是否在凌晨 3:05 和 5:15 之间。如果系统在这些时间之间,脚本应该显示 timechecksuccess.flag,如果系统在这些时间之外,则应该显示 timecheckfail.flag。我的脚本没有失败。你能告诉我哪里出错了。谢谢
Option Explicit`enter
On Error Resume Next
Dim g_objShell, g_strTSuccess, g_strTFail, g_objFS, g_strDone
Set g_objShell = CreateObject("WScript.Shell")
Set g_objFS = CreateObject("Scripting.FileSystemObject")
g_strTSuccess = "C:\TimeCheckSuccess.Flag"
g_strTFail = "C:\TimeCheckFail.Flag"
g_strDone = "C:\Done.Flag"
If g_objFS.FileExists(g_strTSuccess) Then
Call g_objFS.DeleteFile(g_strTSuccess, True)
End If
If g_objFS.FileExists(g_strTFail) Then
Call g_objFS.DeleteFile(g_strTFail, True)
End If
If g_objFS.FileExists(g_strDone) Then
Call g_objFS.DeleteFile(g_strDone, True)
End If
If DatePart("h" ("n", Now()) < 0305 or DatePart("h" ("n", Now()) > 0515 or WScript.Arguments.Named.Exists("Now") ))Then
Call g_objFS.CreateTextFile(g_strTSuccess, True) Else
Call g_objFS.CreateTextFile(g_strTFail, True)
万一
Call g_objFS.CreateTextFile(g_strDone, True)
Set g_objShell = Nothing
Set g_objFS = Nothing
Wscript.Quit