Send keys from the command line

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

+5
source share
2 answers

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

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

You start it from the console using

cscript mute.vbs

More info here

+4
source

Here is a one-line solution: On this line, enter Test 123 , and then press Enter .

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

All Articles