Batch file 从混合批处理VBScript文件中发送密钥

Batch file 从混合批处理VBScript文件中发送密钥,batch-file,vbscript,bluetooth,settings,sendkeys,Batch File,Vbscript,Bluetooth,Settings,Sendkeys,我不知道我到底做错了什么 在下面的脚本中签出,我打算通过“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

我不知道我到底做错了什么

在下面的脚本中签出,我打算通过“
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));
它不进行按键操作,只需打开蓝牙设置窗口并保持原样

感谢您的帮助

Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "ms-settings:bluetooth"
WScript.Sleep 1000
WshShell.SendKeys "{TAB}"
WshShell.SendKeys " "
WScript.Sleep 100
WshShell.SendKeys "%{F4}"
注:我正在遵守该规则列表。我的程序是简单的,而不是不必要的复杂、间接和错误的方式

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