1: gc "C:\scripts\coffee.txt" | ? { $_.Contains("Espresso")} | % { $Espresso+=[int]$($_.substring($_.length-2,2)) };"Espresso: $espresso"
2: gc "C:\scripts\coffee.txt" | ? { $_.Contains("Latte")} | % { $Latte+=[int]$($_.substring($_.length-2,2)) };"Latte: $Latte"
3: gc "C:\scripts\coffee.txt" | ? { $_.Contains("Cappuccino")} | % { $Cappuccino+=[int]$($_.substring($_.length-2,2)) };"Cappuccino: $Cappuccino"
No comments:
Post a Comment