Home > database >  How to Alt Press a Key Using SendKeys in Batch File?
How to Alt Press a Key Using SendKeys in Batch File?

Time:07-29

I need my batch file to press use the Alt LeftArrow shortcut and I am using SendKeys to do so. After some looking, I found that you can use the ^, , and % symbols for control, shift and alt respectively. However,

%SendKeys% "^{LEFT}"
correctly inputs the Ctrl Left shortcut,

%SendKeys% " {LEFT}"
correctly inputs the Shift Left shortcut, but

%SendKeys% "%{LEFT}" does not correctly input the Alt Left shortcut and rather just inputs the left key alone. I can confirm that in this program there is an Alt Left shortcut that works all the time with the keyboard.

It is also worth noting that

%SendKeys% "^%{LEFT}" does not input the Ctrl Alt Left shortcut but rather also does the Ctrl Left input.

I am convinced that % is not the correct symbol and that I am looking for something else. How can I input the Alt Left shortcut with SendKeys? Thanks.

CodePudding user response:

Answered by Anon Coward

Double up the % to %% to escape it.

  • Related