我尝试创build一个简单的UI,在后台运行命令提示符(但是Windows控制台一定不能消失),同时点击每个button,
但之前,我尝试了一些像system("start dir"); 看button是否工作。
这里是问题:当我点击左边的button,出现窗口控制台,不要退出单元我closures它。 但这只适用于system("start dir"); 。 如果我改变目录到ipconfig (或另一个调用函数),Windows控制台将出现一秒钟,并退出。 我尝试了一些像system("PAUSE"); 或getch(); 等等,但它不工作。
为什么这个命令与dir一起工作,而不是与另一个命令?
我在哪里可以findunix上的C头文件
使用memset等结构初始化({…})是否可以吗?
C ++与Python之间的通信(IPC)
另一个OpenGL SuperBible第5版设置问题
有没有办法强制程序留在RAM中
有没有可能预测Linux上的C堆栈溢出?
Win10如何禁用屏幕自动转换(programmaticaly或批处理命令)
将依赖关系Shell32.lib添加到WDK makefile
DIR和IPCONfig之间有一个根本的区别,DIR命令被内置到命令处理器(又名shell)中,IPCONfig是一个单独的程序存储在c: windows system32中。
当你输入START /? 在命令行中,你可以看到为什么它以不同的方式对待它们:
If it is an internal cmd command or a batch file then the command processor is run with the /K switch to cmd.exe. This means that the window will remain after the command has been run. If it is not an internal cmd command or batch file then it is a program and will run as either a windowed application or a console application.
另一种方法是让命令处理器执行命令,然后退出。 你用/ c选项做:
system("cmd.exe /c dir");
或者更简单,因为system()会自动将作业传递给命令处理器:
system("dir");
只要停止使用开始:)
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。