I'm trying to run a VBScript from within another VBScript without creating a new process. I am able to do it using Powershell like so:
Main Script:
# some main script code here
"&'$scriptPath'" | Invoke-Expression
# some main script code here
In Powershell, the above command runs the PowerShell code inside $scriptPath
as if it was a part of the Main script, i.e. running it in the same process.
I would like to achieve this using VBScript.
I've searched the web and aware of objShell.Run "<scriptPath>"
, but this command is running the code in <scriptPath>
in a different process, and not as if it was a part of the main script.
Also I'm aware of the option to read the file content and execute it, but I prefer not to if possible.
How this can be achieved using VBScript?