Trying to learn what this line of PS code does

Morning all,
Somewhat new to PS and ran into a line of code that I do not understand; Line of code is this: $psData | %{‘{0}|{1}|{2}|{3}|{4}’ -f $[0],$[1],$[2],$[3],$_[4] } >> “c:\users\johna\Elements.txt”

The pipe append to an folder and filename is clearly understood, as well as the piping of the input “$psData” variable, but what I’ve not been able to find is a description of %{‘{0}|{1}|{2}|{3}|{4}’ -f $[0],$[1],$[2],$[3],$_[4] }
Looking at the content of the Elements.txt it seems clear that the 0-4 are four ‘|’ values, but like to understand how it works.


Good morning and welcome!

When you have a moment, please go back and format your code: Formatting your code: How to format code on


When you crosspost the same question at the same time to different forums you should at least post links to the other forums along with your question to avoid people willing to help you potentially wasting their time.


You may start your research looking for the “PowerShell format operator -f”:

or here

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.