title: Pass multiple parameter to Powershell function from command line?
body: <p>I am editing a script function to add a function called <code>CloneGitPackage</code>. This is the function I wrote:</p>
  
  <pre><code>function CloneGitPackage {
      $PACKAGE_URL = $args[1]
      $PACKAGE_NAME = $args[2]
  
      write-verbose "Downloading package: $PACKAGE_URL $PACKAGE_NAME"
      git clone --depth 1 $PACKAGE_URL $PACKAGE_NAME 2&gt;$null
      write-verbose ""
  }
  </code></pre>
  
  <p>But the original script has some more other functions:</p>
  
  <pre><code>[CmdletBinding()]
  param(
      [Parameter(Mandatory = $false, Position = 0)]
      [string]$command,
      [Parameter(Mandatory = $false)]
      [switch] $coverage
  )
  
  ...
  
  try{
      switch ($command){
          "bootstrap" { Bootstrap }
          "install" { Install }
          "run_tests" { RunTests }
          "clone_git_package" { CloneGitPackage }
      }
  }catch {
      throw $_
  }
  </code></pre>
  
  <p>I am calling the script like this:</p>
  
  <pre><code> .\script.ps1 "clone_git_package" "https://github.com" "Folder" -verbose
  </code></pre>
  
  <p>But it is complaining:</p>
  
  <pre><code>script.ps1 : A positional parameter cannot be found that accepts argument 'https://github.com'.
  At line:1 char:19
  + ... .\script.ps1 "clone_git_package" "https://github.com/ ...
  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidArgument: (:) [script.ps1], ParameterBindingException
      + FullyQualifiedErrorId : PositionalParameterNotFound,script.ps1
  
  Command executed with exception: A positional parameter cannot be found that accepts argument 'https://github.com'.
  </code></pre>
  
  <p>I supposed the problem is that stranger header the original script already have:</p>
  
  <pre><code>[CmdletBinding()]
  param(
      [Parameter(Mandatory = $false, Position = 0)]
      [string]$command,
      [Parameter(Mandatory = $false)]
      [switch] $coverage
  )
  </code></pre>
  
  <p>These are some valid calls to the script accordingly to its header:</p>
  
  <ol>
  <li><code>.\script.ps1 "bootstrap" -verbose</code></li>
  <li><code>.\script.ps1 "install" -verbose</code></li>
  <li><code>.\script.ps1 "run_tests" -coverage -verbose</code></li>
  </ol>
  
  <p>I need to be able to call the script passing the new function name, on this case <code>clone_git_package</code> and give its arguments, a string <code>git URL</code> and another string <code>directory name</code>.</p>
  
  <p>How can I fix this, without breaking backward compatibility with the other stuff on the script which already uses this stuff?</p>