Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Run cmd command from QProcess without admin privileges



  • Hi,

    I know - my problem is very strange.

    I would like to execute one CMD command from my QT application ( it has admin privileges ) but it must be execute by current user.

    When I execute:

    process->start(R"(hereCmdCommand)");
    

    I execute it with admin privileges, so it doesn't work. I try with "runas", but It doesn't work too ( when I execute it in cmd - I need password and I don't want it ). I try with bat script ( I use windows ). When I double click on it in GUI everything is ok ( in this script I run cmdCommand ). When I execute:
    When I execute:

    process->start(R"(script.bat)");
    

    The result is the same like using

    process->start(R"(hereCmdCommand)");
    


  • It's not that strange of a problem...It's the pleasures of working in windoze.


Log in to reply