Given a list of items in powershell, how do I find the index of the current item from within a loop?
For example:
$letters = { 'A', 'B', 'C' }
$letters | % {
# Can I easily get the index of $_ here?
}
The goal of all of this is that I want to output a collection using Format-Table and add an initial column with the index of the current item. This way people can interactively choose an item to select.