问题
I need help rendering input through 2 different VBScripts. Here's my code, but I need a way of rendering the input of A.vbs into B.vbs, here's my code:
Option Explicit
Dim Shell
Set Shell = CreateObject("WScript.Shell")
Speed = InputBox("How long do you have to wait between clicks, in seconds?", "")
Wait = InputBox("How long until this script runs?", "")
msgbox("You have " & Wait & " seconds until this script runs.")
WScript.Sleep (Wait*1000)
Shell.Run "B.vbs"
回答1:
You can use Environment Variables:
' Create WSH Shell object
Dim objWshShell
Set objWshShell = CreateObject("WScript.Shell")
' Get the Environment
Dim objEnvironment
Set objEnvironment = objWshShell.Environment("System")
' Write to variable
objEnvironment("Speed") = Speed
' Read from variable
MsgBox objEnvironment("Speed")
You will want to write to the environment variable(s) in your A.vbs
script and read from the variable(s) in your B.vbs
script.
来源:https://stackoverflow.com/questions/65587978/how-can-i-send-a-command-to-another-vbscript