How to press a key with batch file

大城市里の小女人 提交于 2019-11-27 07:09:19

问题


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.


回答1:


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

  • How to make a batch file to run a hotkey
  • Batch file that changes URL in open browser
  • Press Keyboard keys using a batch file
  • Automatically respond to runas from batch file

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}");


来源:https://stackoverflow.com/questions/25371406/how-to-press-a-key-with-batch-file

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!