title: Trying to find out if Git is installed via Powershell?
body: <p>I have this short combination of cmdlets(?) that tells by counting how many returns I get, but it only works if Git was installed in the $Env:Path.</p>
  
  <p>I want to use <code>git rev-parse --short HEAD</code>, but check if it is installed beforehand in a PS script.</p>
  
  <pre><code># $gitInstalled = "git" | Get-Command -CommandType Application -ErrorAction SilentlyContinue | measure; 
  # Write-Host $count.Count; 
  </code></pre>
  
  <p>I realize it pretty much answers the question by itself, But I want to know if there is another way, more efficient or broadly covering, to find out if Git is installed?</p>
  
  <p>Edit: So we can shorten the command to just</p>
  
  <pre><code># $gitInstalled = Get-Command -ErrorAction SilentlyContinue git
  </code></pre>