title: Running a WOL PowerShell script through a batch file
body: <p>I am trying to run a PowerShell script through a batch file. I want to do this because I want to have my echo to be able to turn on my computer. (there are probably easier ways to send a WOL request from a echo, but I want to do it through PowerShell for learning purposes)</p>
  
  <p>For the WOL command I have this (I do have the correct values for the dashes, I just don't want to show them):</p>
  
  <pre><code>Send-WOL -mac ------- -ip --------
  </code></pre>
  
  <p>Then my .bat file contains this:</p>
  
  <pre><code>@ECHO OFF
  SET ThisScriptsDirectory=%~dp0
  SET PowerShellScriptPath=%ThisScriptsDirectory%script.ps1
  PowerShell -NoProfile -ExecutionPolicy Bypass -Command "&amp; '%PowerShellScriptPath%'";
  pause
  </code></pre>
  
  <p>Now when I run the .bat file I would get this error:</p>
  
  <pre>
  Send-WOL : The term 'Send-WOL' is not recognized as the name of a cmdlet,
  function, script file or operable program. Check the spelling of the name,
  or if a path was included, verify that the path is correct and try again.
  At C:\Users\hao\Desktop\WOL main\Script.ps1:1 char:1 
  + Send-WOL -mac █████████████████ -ip █████████████
  + ~~~~~~~~
      + CategoryInfo          : ObjectNotFound: (send-WOL:String) [], CommandNotFoundExeption
      + FullyQualifiedErrorId : CommandNotFoundExeption
  
  Press any key to continue . . .
  </pre>
  
  <p>even though when I put the exact same command within the script, manually into PowerShell it works perfectly.</p>