可能重复: C#高级控制台I / O
有没有办法来编辑在C#控制台应用程序的文本?换句话说,有没有可能把pre定义的文本在命令行上,以便用户可以修改文本,然后将其重新提交的应用程序?
Is there a way to edit text in a C# console application? In other words, is it possible to place pre-defined text on the command line so that the user can modify the text and then re-submit it to the app?
一件事。 而且采用的SendKeys一个简单的例子:
One thing that came to my mind is to...simulate keystrokes. And a simple example using SendKeys:
static void Main(string[] args)
{
Console.Write("Your editable text:");
SendKeys.SendWait("hello"); //hello text will be editable :)
Console.ReadLine();
}
注意:这仅适用于当前窗口