【system()函数】
system 是执行一条命令(系统path下搜索到可执行程序),你不能直接给一个文件路径让它去执行
windows 命令行程序中 默认会把文件 送给 explorer.exe 去执行 ShellExecute 或者 ShellExecuteEx
【解决方法】所以你必须把执行 *.bat 或者 *.cmd 写成命令形式:
system(
"cmd.exe /c
"D:
est.bat
"
");
system(
"explorer.exe
"D:
est.bat
"
");
【附】先写一个批处理文件 test.bat 放到路径 d:
下
然后 运行一下 C/C++代码(已在 mingw gcc 下 调试通过)
#include