Skip to content

Instantly share code, notes, and snippets.

@bklockwood
Created October 22, 2015 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bklockwood/ee76c76cb57057e2da50 to your computer and use it in GitHub Desktop.
Save bklockwood/ee76c76cb57057e2da50 to your computer and use it in GitHub Desktop.
comparison operator in switch statement
$size = $(get-item .\Rootstore.sst).Length
Write-Host "Size $size"
switch ($size) {
($_ -gt 30000000000) {$foo = "reallybig" ;break}
($_ -lt 25000000000) {$foo = "size5" ;break}
($_ -lt 20000000000) {$foo = "size4" ;break}
($_ -lt 15000000000) {$foo = "size3" ;break}
($_ -lt 10000000000) {$foo = "size2" ;break}
($_ -lt 5000000000) {$foo = "size1" ;break}
}
Write-Host "the file is: $foo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment