Sendkeys from command prompt

血红的双手。 提交于 2019-12-21 04:39:22

问题


Is there a way to use sendkeys (or something equivalent) from (not to) the command prompt?


回答1:


You can use vbscript. For example, this script will mute the speakers.

set shell = CreateObject("WScript.Shell")
shell.run"Sndvol"
WScript.Sleep 1500
shell.SendKeys"{TAB}"
shell.SendKeys" "
shell.SendKeys"%{F4}"

You launch it from the console with

cscript mute.vbs

More infos here




回答2:


Here is a one line solution: This line will type "Testing 123" and then hit Enter.

echo >script.vbs set shell = CreateObject("WScript.Shell"):shell.SendKeys "Testing 123{ENTER}" & script.vbs


来源:https://stackoverflow.com/questions/9709474/sendkeys-from-command-prompt

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