Get last element of pipeline in powershell
问题 This might be weird, but stay with me. I want to get only the last element of a piped result to be assigned to a varaiable. I know how I would do this in "regular" code of course, but since this must be a one-liner. More specifically, I'm interested in getting the file extension when getting the result from an FTP request ListDirectoryDetails . Since this is done within a string expansion, I can't figure out the proper code. Currently I'm getting the last 3 hars, but that is real nasty. New