title: Logged in user, Windows, in Golang
body: <p>I need to get the currently logged in user(s) on the local Windows machine, using Golang.  I'm not looking for the user currently running the application, which can be got from the built-in function <code>user.Current()</code>.</p>
  
  <p>I can call <code>query user</code> from cmd and this gives me the list (string manipulation required, but that is not a problem) of users I need.</p>
  
  <p>The code I have tried is:</p>
  
  <pre><code>out, err := exec.Command("query", "user")
  if err != nil {
    panic(err)
  }
  // ...do something with 'out'
  </code></pre>
  
  <p>This produces the error <code>panic: exit status 1</code>.  The same occurs if I do:</p>
  
  <pre><code>out, err := exec.Command("cmd", "/C", "query", "user")
  ...
  </code></pre>