When I try to get a count of items, e.g. with
(gci).count to count files in a folder, PowerShell returns no output for empty lists or lists containing only one item. It works fine for lists containing multiple items, though.
How can I get PowerShell to return proper numeric values for all cases? i.e.: How can I get it to output an actual zero for empty lists, and output one for single-item lists?
My particular use case, as further described in the related question linked above, is to get a count of items in a list that results from piping a
gci command's output to