类型不匹配:在 vbs 中导入 [英] Type mismatch: Imports in vbs
问题描述
我正在分析一个 vbs 脚本,但由于第一行,我无法调试,比如我尝试运行:
I am analyzing a vbs script and I cannot debug because of the very first line, say I try running:
Imports System.Class
Class.WriteLine("hello")
返回错误类型不匹配:导入".由于限制,我正在处理 cmd.exe.
Which returns the error "Type mismatch: Imports". I'm working on the cmd.exe because of limitations.
那么,这个问题的根源是什么?
So, what could be the source of this problem?
有没有一种方法可以运行此代码而无需安装其他东西?
Is there a way to run this code without having to install something else?
推荐答案
这肯定不是 Vbscript 代码.
Vbscript 中没有 Imports
语句.
There is no Imports
statement in Vbscript.
您可以在 Class
类中创建一个 WriteLine
方法,多余的括号将被忽略,但它是 Imports
表示这不是 Vbscript.
You might be able to create a WriteLine
method in a Class
class, and the superfluous brackets would be ignored, but it´s the Imports
that indicates this is not Vbscript.
(括号是多余的,因为无论 WriteLine
是 Function
还是 Sub
-- 引用都不使用函数结果(如果它是一个函数),因此括号将被解释为表达式的一部分,该表达式为 WriteLine
的第一个(也是唯一一个)形参传递实际参数,因为调用了 Sub
或 Function
(不使用其返回值)不允许参数列表使用方括号.)
(The brackets are superfluous because no matter if WriteLine
were a Function
or a Sub
-- the reference does not use the function result (if it was a function), and thus the brackets would be interpreted as part of the expression that delivers the actual parameter for the first (and only) formal parameter of WriteLine
because calling a Sub
or Function
(without using its return value) does not allow brackets for the argument list.)
这篇关于类型不匹配:在 vbs 中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!