title: How to run functions of Windows powercfg with Python code?
body: <p>Trying to use Python for more than text parsing and figure the best way is to write a script I will find useful. I'm having an issue though I get an error when making the call. </p>
  
  <pre><code>from subprocess import call
  call (["powercfg", "/batteryreport"])
  </code></pre>
  
  <p>The error I receive is the following: </p>
  
  <blockquote>
    <p>An unexpected error condition has occurred. Unable to perform operation. You may not have permission to perform this operation.</p>
  </blockquote>
  
  <p>I've run the command prompt under elevated user privileges as well with no dice. Any help would be appreciated.</p>
  
  <p><em>Note: For those unfamiliar this command creates an HTML file of your battery use on Windows in your user directory (C:\Users\Name).</em></p>