Calculate the value of an expression and return the result.
[result = ]Eval( expression )
result
Optional. is a variable that accepts the returned result. If no result is specified, consider using the Execute statement instead.
Expression
Required option. Can be a string containing any valid VBScript expression.
In VBScript, x = y can have two explanations. The first method is to assign the value of y to x . The second explanation is to test whether x and y are equal. If equal, result is True; otherwise result is False. The Eval method always uses the second explanation, while the Execute statement always uses the first one.
Note that this kind of confusion between comparison and assignment does not exist in Microsoft(R) Visual Basic Scripting Edition, because the assignment operator (=) is different from the comparison operator (==).
Execute one or more specified statements.
Execute statements
The required statements parameter is a string expression containing one or more statements to be executed. If you want to include multiple statements in the statements parameter, you should separate them with semicolons or embedded branches.
In VBScript, x = y can have two explanations. First, as an assignment statement, assign the value of y to x . The second is to test whether the values of x and y are equal as an expression. If equal, the result is True; otherwise, the result is False. The Execute statement always uses the first explanation, while the Eval method always uses the second.
Note that there is no confusion between assignment and comparison in Microsoft(R) Visual Basic Scripting Edition, because the assignment operator (=) and the comparison operator (==) are different.
The context in which the Execute statement is called determines the objects and variables that can be used by the code to run. Objects and variables within scope are available to code running in Execute statements. However, one thing that must be understood is that if the executed code creates a process, the process will not inherit the scope of the process it is in.
Similar to other processes, the scope of a new process is global, and it inherits everything from the global scope. Unlike other processes, its context is not global scope, so it can only be executed in the context within the process where the Execute statement occurs. However, if the same Execute statement is called in scope outside the procedure (for example in the global scope), then it will not only inherit everything in the global scope, but it can also be called anywhere, because its context is global.
Execute a work of multiple statements specified in the script global namespace.
ExecuteGlobal statement
The statement parameter is a string expression containing one or more executable statements. You can include multiple statements in the statement parameter, and use a colon to separate them.
In VBScript, x = y