3个回答
2013-09-23
展开全部
#include <windows.h>
代码中写
SYSTEM(" <指令>");
引号里面是字符串,所以很简单的吧?
写个死循环,接收字符串,放到这里来就好了
while(true){
char str[256]={0};
scanf("%s",str)
SYSTEM(str);
}
代码中写
SYSTEM(" <指令>");
引号里面是字符串,所以很简单的吧?
写个死循环,接收字符串,放到这里来就好了
while(true){
char str[256]={0};
scanf("%s",str)
SYSTEM(str);
}
2013-09-23
展开全部
可以使用int system(const char *command)函数
来调用DOS命令
*command指的是DOS命令
调用成功则返回0,否则返回-1
例如system("dir");
来调用DOS命令
*command指的是DOS命令
调用成功则返回0,否则返回-1
例如system("dir");
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
2013-09-23
展开全部
void CDlgtest4Dlg::OnButton9()
{
// TODO: Add your control notification handler code here
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "cmd.exe";
ShExecInfo.lpParameters = _T("/k dir");
ShExecInfo.lpDirectory = _T("");
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
}
你可以执行cmd /?查看CMD的参数
{
// TODO: Add your control notification handler code here
SHELLEXECUTEINFO ShExecInfo = {0};
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpFile = "cmd.exe";
ShExecInfo.lpParameters = _T("/k dir");
ShExecInfo.lpDirectory = _T("");
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShellExecuteEx(&ShExecInfo);
}
你可以执行cmd /?查看CMD的参数
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询