Advertisement
Guest User

Untitled

a guest
Dec 15th, 2018
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. param (
  2.     [String]$Input_1
  3. )
  4.  
  5. function Info([String]$s) {
  6.     if ([String]::IsNullOrWhiteSpace($s)) {
  7.         return 1
  8.     }
  9.     if ($s -eq '?' -or $s -eq 'help') {
  10.         return 2
  11.     }
  12.     if ($s -eq '--help' -or $s -eq '--h') {
  13.         return 3
  14.     }
  15.     if ($s -eq "-h") {
  16.         return 4
  17.     }
  18. }
  19.  
  20. switch(Info($Input_1)) {
  21.     { $_ -eq 1 } {Write-Output "[ps-test] Usage: ps-test ... Variant 1"; Exit}
  22.     { $_ -eq 2 } {Write-Output "[ps-test] Usage: ps-test ... Variant 2"; Exit}
  23.     { $_ -eq 3 } {Write-Output "[ps-test] Usage: ps-test ... Variant 3"; Exit}
  24.     { $_ -eq 4 } {Write-Output "[ps-test] Usage: ps-test ... Variant 4"; Exit}
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement