简体   繁体   English

如何将命令传递给已经在C#中运行的命令提示符?

[英]How to pass commands to already running command prompt in C#?

假设我在系统中打开了命令提示符,现在我只想通过c#程序将命令传递给该打开的命令提示符窗口,而我不想打开命令提示符窗口的新实例来执行我​​正在通过C#程序传递的命令。

I'm not quite sure what you mean "open new instance" to execute arguments which you passed already. 我不太确定您要执行已传递的参数的“打开新实例”的意思。 However, if you are not quite sure how to parse intensively command line arguments you can take a reference of this link : 但是,如果您不太确定如何深入分析命令行参数,则可以参考以下链接:

Best way to parse command line arguments 解析命令行参数的最佳方法

You need to send keys to an open application. 您需要将密钥发送到打开的应用程序。 The belolw link will help you belolw链接将为您提供帮助

http://www.codeproject.com/Articles/18366/Sending-Keystrokes-to-another-Application-in-C http://www.codeproject.com/Articles/18366/Sending-Keystrokes-to-another-Application-in-C

您可以尝试使用FindWindow API和SendKeys。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM