Search code examples
cmdsendkeys

Sendkeys from command prompt


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


Solution

  • 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