title: How can I associate a file type with a powershell script?
body: <p>I have a very powershell script that works perfectly and does:</p>
  
  <pre><code>Param(
    [string]$fileName
  ) 
  
  echo "Woo I opened $fileName"
  </code></pre>
  
  <p>When I run it on the command line, it works:</p>
  
  <pre><code>my-script.ps1 .\somefile
  </code></pre>
  
  <p>Returns:</p>
  
  <pre><code>Woo I opened somefile
  </code></pre>
  
  <p>I would like to associate <code>my-script.ps1</code> with a particular file type. I am attempting to do this via 'Open With'  However:</p>
  
  <ul>
  <li>Windows doesn't include Powershell scripts as 'Programs' (though it considers CMD and batch scripts as 'Programs')</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/5kYBz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/5kYBz.png" alt="enter image description here"></a></p>
  
  <ul>
  <li>When I pick 'All Files' instead, and pick my powershell script, Windows shows this message </li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/e8V6m.png" rel="noreferrer"><img src="https://i.stack.imgur.com/e8V6m.png" alt="enter image description here"></a></p>
  
  <p><strong>How can I associate a file type with a Powershell script?</strong></p>