VBscript - 多行 IF 语句产生错误

VBscript - multiline IF statement yielding error

我有一个可以正常运行一年的基本脚本。最近,我试图向其中添加一个 IF 语句,因此如果当前日期是一年中的特定日期,即 1 月 18 日,则不要 Msgbox。我认为这会相当简单,但是在 IF 语句的第一行 运行 变成 Sub or Function not defined 我似乎无法自己解决:

If Not CStr(Date()) Like  "1/18/*" _ 
And Not CStr(Date()) Like "2/15/*" _
And Not CStr(Date()) Like "12/31/*" Then
MsgBox "perform task"
Else
MsgBox "do not perform task"
End If

谁能告诉我我错过了什么?

VBScript 中没有 Like 运算符。实现您想要做的事情的一种方法是:

MonthAndDay = Month(Date) & "/" & Day(Date)

If MonthAndDay <> "1/18" _
   and MonthAndDay <> "2/15" _
   and MonthAndDay <> "12/31" Then
   MsgBox "perform task"
Else
   MsgBox "do not perform task"
End If