6

Hi I am new with batch file, I want to know how to auto press a key from batch file. I want to make a program that open a browser and press the tab key automatically.

aschipfl
  • 33,626
  • 12
  • 54
  • 99
Yagel
  • 1,184
  • 2
  • 18
  • 41

1 Answers1

9

A search for "batch file sendkeys" and further revision returned this list of answers for similar questions:

The Batch file below do what you want:

@if (@CodeSection == @Batch) @then
@echo off
CScript //nologo //E:JScript "%~F0"
rem Open the browser here
goto :EOF
@end
WScript.CreateObject("WScript.Shell").SendKeys("{TAB}");
Community
  • 1
  • 1
Aacini
  • 65,180
  • 12
  • 72
  • 108
  • 1
    Do we need anything else in our .bat file when we want to press enter after opening an app other than WScript.CreateObject("WScript.Shell").SendKeys("{ENTER}"); – rdj7 Apr 19 '17 at 10:20