powershellHow to retrieve last element of array
This code first retrieves the keys of the $arr
array using the keys
property, then uses the select
cmdlet with the -last 1
parameter to retrieve the last key of the array. Finally, it retrieves the value at that key from the $arr
array and assigns it to the $last
variable.
More of Powershell
- How to get current PS cmdlet general shell hosting info and version(s)
- How to get detailed PS versioning information of your system
- How to filter a list of strings by specific text included in string
- How to get local system keyboard layout information
- How to retrieve numbers divisible by 10 from a list of values
- How to validate default keyboard layout is EN-US
- How to measure command execution time
- How to retrieve an array that is inside another array or list
- How to retrieve your internet's public facing IP address in powershell
See more codes...