How to send ALT + SPACE key using sendkey method?

I am implementing a desktop application where I want to send a keyboard shortcut ALT+SPACE

, but I cannot find a way to do it.

I am doing this to automatically handle the following tasks:

  • enter the tracert command in the command line
  • copy the result
  • paster result in notepad

Can anyone help me with this ??


source to share

2 answers

try it

System.Windows.Forms.SendKeys.Send("% ");


Usage is a SendKeys

bit "hacked". I would suggest using the Process class instead, something like below

public string GetTracert(string ip)
    Process p = new Process();
    p.StartInfo.FileName = "tracert";
    p.StartInfo.Arguments = "";
    p.StartInfo.RedirectStandardOutput = true;

    return p.StandardOutput.ReadToEnd();




Just check

<hit>% {space} hit>

SendKeys.Send("% ");

// {SPACE} is invalid, so use normal ""

This should emulate pressing Alt + Space



All Articles