title: $($args[2]) is not printing argument passed
body: <p>I have a batch file (runPowerShell.bat) with the following line:</p>
  
  <pre><code>Powershell.exe -ExecutionPolicy ByPass -File %psFile% %2 %3 %4 %5
  </code></pre>
  
  <blockquote>
    <p>%1 is psFile in which the powershell file is passed in</p>
    
    <p>%2 is another argument i intend to pass later</p>
    
    <p>%3 is the arg i wanna print for now</p>
  </blockquote>
  
  <p>The powershell file (scriptWrapper.ps1) contains this:</p>
  
  <pre><code>param($App_input)
  
  $Script = "$($args[2])" #%2 for process or sync
  
  write-host $Script
  </code></pre>
  
  <p>There is another PowerShell file called </p>
  
  <blockquote>
    <p>Process.ps1</p>
  </blockquote>
  
  <p>that i wish to pass as %3 argument, meaning <code>$args[2]</code></p>
  
  <p>if i say <code>write-host "$args[2]"</code> it prints like this:</p>
  
  <p>Process.ps1[2]</p>
  
  <p>so it kinda works but i dont want the positional parameter with it, so I followed this thread for guidance, and the solution (<code>$($args[2])</code>) makes sense, but I am unsure why its not working for me</p>
  
  <p><a href="https://stackoverflow.com/questions/12326205/accessing-the-args-array-in-powershell">accessing the $args array in powershell</a></p>
  
  <p>it prints nothing:</p>
  
  <p><a href="https://i.stack.imgur.com/M8qSv.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/M8qSv.png" alt="Not printing"></a></p>