如何将命令发送到CMD.exe?或编写像CMD.exe这样的应用程序 [英] How Can I send a command to CMD.exe ? or write a application like CMD.exe

查看:399
本文介绍了如何将命令发送到CMD.exe?或编写像CMD.exe这样的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,
我想像CMD.exe一样编写MFC应用程序,并向其发送命令并运行我的命令.

也许我可以这样编写控制台应用程序:

#include< windows.h>
#incldue< stdlib.h>
{
system("route -p add 0.0.0.0 mask 0.0.0.0 192.168.0.1");
}
也许我可以按以下字符串:route -p add 0.0.0.0 mask 0.0.0.0 192.168.0.1然后在打开它后在CMD.EXE中按Enter键

但是他需要MFC应用程序.

我该怎么做?如果您能向我展示您的代码,我将不胜感激.
在此先感谢您.

Hello,
I want to write a MFC application just like the CMD.exe,and send a command to it and run my command.

Maybe I can write console application like this:

#include<windows.h>
#incldue<stdlib.h>
{
system("route -p add 0.0.0.0 mask 0.0.0.0 192.168.0.1");
}
Or maybe I can press the strings: route -p add 0.0.0.0 mask 0.0.0.0 192.168.0.1 Then press the Enter button in the CMD.EXE after I opened it

But He requires a MFC application.

How Can I Do It? I would appreciate if you could show me your code.
Thanks in advance.

推荐答案

Google"mfc createprocess".您将获得超过160万次的点击.
Google "mfc createprocess". You''ll get over 1.6 million hits.


这篇关于如何将命令发送到CMD.exe?或编写像CMD.exe这样的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆