Script parameter parsing in PowerShell

This is an example of how to do script parameter parsing in PowerShell:

switch ($args)
{
  'salesforceservice'
  {
    $deploy_service = $true
  }

  'web'
  {
    $deploy_web = $true
  }

  default
  {
    "Bad parameter: " + $_
    ShowHelp
    exit
  }
}

Pretty neat, huh?

/Emil

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.