title: How do I pass arguments or variables from one powershell script to another?
body: <p>In cmd I could pass arguments from one bat to another by listing them after the to-be-run bat file was stated. Then the to-be-run bat received them as %1, %2, %3, etc.  Can this be done in Powershell? </p>
  
  <p>I have one ps1 script,script1, that prompts the user for a location. That script has been taken care of. That location is stored as a variable; $loc.  In the first script, there is a point that the user can choose an option that will run another ps1 script, script2, that has itself more options. I want to pass $loc to the script2 from script1.  </p>
  
  <p>In script1 I have tried the following:</p>
  
  <pre><code>param ($loc)
  start-process "\script2.ps1" -ArgumentList $loc
  start-process "\script2.ps1" -$loc
  start-process "\script2.ps1"
  </code></pre>
  
  <p>Then is script 2</p>
  
  <pre><code>args[0]
  $loc
  </code></pre>
  
  <p>I know I'm probably just not understanding passing arguments. Thing is that another options calls a bat script. That one I use -ArgumentList $loc and it passes that fine. I pick that argument up in the bat script using "Set loc = %1"</p>