-1

我在 C++、Visual Studio 2010、Win7 中编写了一个 Windows 窗体应用程序,我需要打开命令提示符,然后键入特殊命令来运行其他程序。

我使用这个功能:

system("cmd.exe /c 目录 c:\");

但它显示了一秒钟然后消失了!我用这个来解决:

cin.get();

但它不起作用!

我也试过这个功能:

字符程序[] = "C:\Windows\System32\cmd.exe"; WinExec((LPCSTR)程序,SW_SHOWMINIMIZED);

但它没有任何作用。

你能帮我吗 ?

太感谢了!

4

2 回答 2

0

利用system("cmd.exe /c dir c:\\");

于 2013-08-10T08:24:33.093 回答
-1

尝试:system("cmd /c dir c:\\ & pause");

于 2013-08-10T08:46:03.313 回答