0

I need to run cmd script that is generated during program execution.

I tried using system(…) command however it seems it is not possible to get admin rights for script launched that way.

I tried using ShellExecute(…) however it seems it can run only already existing files - I can't pass string that exist only during program execution to ShellExecute. I want to avoid creating temporary files.

Here is part of my code

std::string cmdScript =
        "cd %" + path_third_party_app + "%\\bin &&"
        "curl \"https://bootstrap.pypa.io/get-pip.py \" -o \"get-pip.py\" && "
        //...and so on
        "pause \n"
int res = system(cmdScript.c_str());

This script works only if it is called with admin rights (to test I tried calling this script by launching it manually with admin rights and it works), but I can't find a way to force it to be run with admin rights by application, and I don't want if possible writing yet another band-aid solution.

Is there any other way to do this that I missed?

0 Answers0