title: QT Start program as regular user
body: <p>My auto updater requires admin privileges to run since its modifying files in the programs folder. This all works fine.</p>
  
  <p>However, when the update is done I want my <code>updater.exe</code> to start <code>myApplication.exe</code> but <strong>without</strong> admin privileges.</p>
  
  <p>The code I currently use to start myApplication.exe from updater.exe:</p>
  
  <pre><code>bool started = QDesktopServices::openUrl(QUrl::fromLocalFile(exeFileName));
  if (started)
  {
      QApplication::quit();
  }
  </code></pre>
  
  <p>The problem is that when <code>myApplication.exe</code> is started as admin it messes up my local paths, for example:</p>
  
  <pre><code>QString addin_path = QStandardPaths::writableLocation(QStandardPaths::DataLocation);
  </code></pre>
  
  <p>Points to the admin users folder. And not the actual user who is running the application.</p>
  
  <p>Any ideas here?</p>
  
  <p><strong>update</strong></p>
  
  <p>Based on Merlin069's answer I'm testing the following:</p>
  
  <pre><code>TCHAR username[UNLEN + 1];
  DWORD size = UNLEN + 1;
  GetUserName((TCHAR*)username, &amp;size);
  
  qDebug() &lt;&lt; QHostInfo::localHostName();
  
  QProcess::startDetached("runas \"/user:&lt;" + QHostInfo::localHostName() + "&gt;\"" + username + ""\" \"" + exeFileName + "\");
  </code></pre>