title: How do I check if my program is running under admin privileges via C++?
body: <p>How do I check if my C++ program is running with admin privileges?</p>
  
  <p>I did it in this manner for batch</p>
  
  <pre><code>set fold=%random%
  
  mkdir "C:\Windows\%fold%"
  
  if errorlevel 1 (
  
  goto Tag1
  
  )
  
  goto Tag2
  </code></pre>
  
  <p>But I cannot use the same thing for C++ because I do not know how to transfer value of %random% that is variable 1 to variable 2 that is %fold% and also, I do not know if there is error level for C++.</p>
  
  <p>Can anyone help me in this case or is there any way to check if my program is running with admin privileges?</p>