【问题标题】:How can I send a command to another VBScript? [duplicate]如何将命令发送到另一个 VBScript? [复制]
【发布时间】:2023-03-27 18:06:02
【问题描述】:

我需要通过 2 个不同的 VBScript 渲染输入的帮助。这是我的代码,但我需要一种将 A.vbs 的输入渲染为 B.vbs 的方法,这是我的代码:

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"

【问题讨论】:

    标签: vbscript


    【解决方案1】:

    您可以使用环境变量:

    ' 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")
    

    您需要写入A.vbs 脚本中的环境变量,并从B.vbs 脚本中的变量中读取。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-10-14
      • 2011-02-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-01-22
      • 2013-10-24
      相关资源
      最近更新 更多