Emil’s Blog

Programming Windows, .Net, EPiServer and whatnot…

[Powered by WordPress.]

January 21, 2010

Script parameter parsing in PowerShell

by @ 14:32. Filed under 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

[powered by WordPress.]

jour·nal n. A personal record of occurrences, experiences, and reflections kept on a regular basis; a diary.

Internal links:

Categories:

Search blog:

Archives:

September 2010
M T W T F S S
« Jun    
 12345
6789101112
13141516171819
20212223242526
27282930  


View Emil Åström's profile on LinkedIn

General links:

I read:

Visitors

Recent Comments

Spam caught

Other:

Clicky Web Analytics

41 queries. 0.342 seconds