错误使用JScript在.bat文件中生成ALT + object.SendKeys(string)

我试图发送击键到一个程序在Windows(正好7亲)使用.bat文件,我来到这个问题: 按键盘键使用batch file

它工作得很好,但我不能使用ALT键。 我的想法是打开notepad.exe,并使用ALTbutton去顶部菜单(存档,编辑…)的选项。 当我手动使用它时,它可以工作,但是当我使用代码%SendKeys% "%a"作为例子(或者只有altbutton%SendKeys% "%" )时,它只会在记事本中写入a ,而不会按下ALT。 我做错了什么?

如何使用SendKeys方法: msdn microsoft

我的代码:

 @if (@CodeSection == @Batch) @then @echo off ::rem Use %SendKeys% to send keys to the keyboard buffer set SendKeys=CScript //nologo //E:JScript "%~F0" start "" /BC:\Windows\System32\notepad.exe timeout 2 %SendKeys% "%a" goto :EOF @end // JScript section var WshShell = WScript.CreateObject("WScript.Shell"); WshShell.SendKeys(WScript.Arguments(0));