Run System( ) CMD commands with Admin rights
<p>I'm trying to find a way to run CMD commands as Administrator in my C++ code.</p>

<p>i.e: </p>

<pre><code>system("taskkill /im mygame.exe");
</code></pre>

<p>This won't work and it will pop up an "Error: Access Denied" Message.
If I run Windows CMD as Admin and execute the same command directly, it will work perfectly.</p>

<p>So what would be a way to use CMD as Administrator automatically in C++?</p>

<p>I've read some other threads on here but nothing I can directly relate/ get from them.</p>

<p>Examples are very appreciated.</p>