VB 脚本 if 语句:Sub 未定义
我有下面的代码
if (LCase(Config_(C_))) like "show*" Then
crt.screen.send Config_(C_) & VBCR
crt.screen.WaitForStrings ">", "#"
End If
,但当我运行它时,我得到一个“Sub not Define on line 36”(即“if(LCase(.....”行)
Config_
is an array of strings) C_
是元素地址
所以我想做的就是说,
如果这个数组元素以“show”开头,则运行命令,确保用户输入大写或小写都没关系。
为什么这段代码不起作用?其他 if like 语句似乎还可以。
I have the code below
if (LCase(Config_(C_))) like "show*" Then
crt.screen.send Config_(C_) & VBCR
crt.screen.WaitForStrings ">", "#"
End If
but when I run it I get a "Sub not defined on line 36 (which is the "if(LCase(....." line)
Config_
is an array of stringsC_
is the element address
So all I want to do is say,
If this array element starts with "show" then run the command, insuring it does not matter if the user emters upper or lower case.
Why this code does not work? Other if like statements seem ok.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
据我所知,vbscript 中没有
like
语句。您可以使用Left
它将在字符串开头返回 n 个字符,并查看它返回的字符串是否等于“show” -As far as I'm aware, there's no
like
statement in vbscript. You could useLeft
which will return n number of characters at the start of a string and see if the string it return equals "show" -作品“LIKE”不是 vbscript 中的关键字或函数
The work "LIKE" is not a key word or a function in vbscript