title: How to call a function within & in powershell?
body: <p>Suppose I have a function in test.ps1, its name is show the code is like below:</p>
  
  <pre><code>. "some_path\some_other_script.ps1"
  
  function show {
      write-host "Hello World"
      #some other function call from some_other_script.ps1
      ...
  }
  </code></pre>
  
  <p>How can I call show in follow format (in a &amp; - call operator)</p>
  
  <pre><code>powershell.exe "&amp; '%test_script_path%\test.ps1'\show"
  </code></pre>
  
  <p>I think I need to dot source test.ps1 first in order to get dependencies in show function from some_other_script.ps1</p>
  
  <p>I know I can create a new script and put the code in show in the new script instead of in a function. In that way, when do &amp;... the script will be invoked. But I don't want to create a new script just for a very simple function</p>
  
  <p>Thanks for any suggestion</p>