【问题标题】:Sendkeys from within hybrid Batch-VBScript file混合 Batch-VBScript 文件中的发送键
【发布时间】:2020-06-10 23:13:36
【问题描述】:

我想不通,我在这里做错了什么。

签出下面的脚本,我打算在其中通过SendKeys 方法切换蓝牙启用设置:

@if (@CodeSection == @Batch) @then

@echo off

set SendKeys=CScript //nologo //E:JScript "%~F0"

start "" /b explorer.exe ms-settings:bluetooth

%SendKeys% "{TAB}" & %SendKeys% " "

goto :EOF

@end

// JScript section
var WshShell = WScript.CreateObject("WScript.Shell");
WshShell.AppActivate "settings":WScript.Sleep 300
WshShell.SendKeys(WScript.Arguments(0));

它不做按键操作,只是打开蓝牙设置窗口并保持原样。

感谢任何帮助。

【问题讨论】:

    标签: batch-file vbscript bluetooth settings sendkeys


    【解决方案1】:
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "ms-settings:bluetooth"
    WScript.Sleep 1000
    WshShell.SendKeys "{TAB}"
    WshShell.SendKeys " "
    WScript.Sleep 100
    WshShell.SendKeys "%{F4}"
    

    注意:我遵守该规则列表。我的程序很简单,而不是不必要的复杂、间接和以错误的方式做事。

    【讨论】:

      猜你喜欢
      • 2020-12-30
      • 1970-01-01
      • 1970-01-01
      • 2015-03-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-29
      • 2020-12-24
      相关资源
      最近更新 更多