SendKeys.Send("%"); 不发送"%"符号

Dim*_*ich -2 c# .net-4.5

SendKeys.Send("%"); 不发送"%"符号

    while (true)
    {
        string a2 = @"%%asdf%%";
        foreach (char a in a2)
        {
              SendKeys.Send(a.ToString());
        }
        System.Threading.Thread.Sleep(1000);
    }
Run Code Online (Sandbox Code Playgroud)

Dav*_*haw 11

来自MSDN:

加号(+),插入符号(^),百分号(%),波浪号(〜)和括号()对SendKeys具有特殊含义.要指定其中一个字符,请将其括在大括号({})中.

SendKeys.Send 也需要一个字符串.

那么为什么不呢:

string a2 = @"{%}{%}asdf{%}{%}";
SendKeys.Send(a2);
Run Code Online (Sandbox Code Playgroud)