windows 如何从没有控制台窗口的 C/C++ 执行批处理文件?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/6671410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
how to execute batch file from C/C++ w/o console window?
提问by Andriy Tylychko
I'm executing batch file from a C++ program by system("start /B mybatch.bat")
call, where /B
is supposed to run batch file w/o console window. But it's still visible.
我正在通过system("start /B mybatch.bat")
调用从 C++ 程序执行批处理文件,/B
应该在没有控制台窗口的情况下运行批处理文件。但它仍然可见。
Edit: I resolved the issue by ShellExecute()
as was proposed in comments
编辑:我ShellExecute()
按照评论中的建议解决了这个问题
回答by ?lex
Why don't you use CreateProcess instead ?
为什么不使用 CreateProcess 呢?