# Das einfachste Beispiel $a = "Hi" $b = "Attendees" "{0}" -f $a,$b "{1}" -f $a,$b "{0} {1}" -f $a,$b "{0} ------------------ {1}" -f $a,$b # Lets do a better example [array]$formatArray = @('you','values','they') $user = (Get-ChildItem Env:\USERNAME).Value $date = Get-Date "Your username is {0}, and the time is {1:HH}:{1:mm}:{1:ss}" -f $user,$date # IMPORTANT - Format-keywords are case-sensitive "Your username is {0}, and the time is {1:HH}:{1:MM}:{1:ss}" -f $user,$date # Formatieren von Arrays "Those {1} appear where {0} {2} place them" -f $formatArray "Those $($formatArray[1]) appear where {0} {2} place them" #-f $formatArray # Formatieren direkt in der Pipeline Get-Process |Select-Object -first 3 {"Processname is: {0} and this ID is {1}" -f $_.ProcessName,$_.id} # Padding (,10 means 10 digits for a row) and Hex-Values '|{0,10}|0x{1:x}|{2,-10}|' -f 10,15,30 # Currency format 'Amount: {0:c}' -f 123 'Amount: {0:c}' -f 123456,78 # Zahlenformate 'Amount: {0:n}' -f 123456.22 'Amount: {0:n1}' -f 123456.22 'Amount: {0:n2}' -f 123456.22 'Amount: {0:n3}' -f 123456.22 # Percent values '{0:p}' -f 0.80 # date-games $now = Get-Date '{0}' -f $now '{0:dd}' -f $now '{0:dddd}' -f $now '{0:MM}' -f $now '{0:yyyy}' -f $now 'it was {0:dddd}, the {0:dd}.{0:MM}.{0:yyyy} at {0:HH} Uhr {0:mm}!' -f $now # More on https://ss64.com/ps/syntax-f-operator.html