我想知道是否有可能以及如何通过升级过程在Windows上启动.bat或在Linux脚本上启动.sh?
答案 0 :(得分:1)
启动批处理文件的示例:
#include <boost/process.hpp>
#include <string>
#include <iostream>
using namespace boost::process;
int main()
{
context ctx;
ctx.environment = self::get_environment();
child c = launch("cmd", "/c batch.bat", ctx);
status s = c.wait();
if (s.exited())
std::cout << s.exit_status() << std::endl;
}
未测试。关键是使用/ c
将批处理文件传递给cmd