If you can rewrite the script that installs the environment in C ++, you can create the environment yourself and install it using the
voidQProcess::setProcessEnvironment ( const QProcessEnvironment & environment )
method, as in the example given in the documentation method:
QProcess process;
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
env.insert("TMPDIR", "C:\\MyApp\\temp");
env.insert("PATH", env.value("Path") + ";C:\\Bin");
process.setProcessEnvironment(env);
process.start("myapp");
UPDATE
, cmd.exe :
#include <QtCore/QCoreApplication>
#include <QtCore/QProcess>
int main(int argc, char *argv[])
{
QCoreApplication app(argc, argv);
QProcess* proc = new QProcess();
proc->start("cmd.exe /c \"call env.bat && script.bat\"");
return app.exec();
}
env.bat
set abc=test
script.bat
echo %abc% > a.txt
a.txt
test