In a string, the syntax $( $obj.property ) returns the content of the property “property” of the variable obj.
if you just put $_.property, $_ is replaced by a string representing the object (in case of item, it is the property name) and is concatenate with the string “.property”
Example : suppose that $_ represente the item c:\windows\win.ini
To answer your last question first, $_ represents the item that was taken from the pipeline (which is being filled by the Get-ChildItem cmdlet) by the Foreach-Object and passed into your code block. Why is it named $_? It’s a common representation taken from PowerShells’ predecessors, e.g. Perl, that represents “the current item”.
The reason "$_.FullName" returns only the file name followed by the string “.FullName” because only the $_ in resolved. The “.FullName” is treated as a literal string value.
The reason "($_.Fullname)" returns only the file name (without the “.FullName”) is because you’ve now supplied an expression, and the value of the expression is the “FullName” property of the current item ($_).
String interpolation can be a real PITA, and it’s also slower that using the format operator -f. To get the result you want, try using this instead:
As dot character is not allowed in variable name :
in the syntax “$_.fullname”, powershell considers that $_ is the object to display and .fullname a literal string.
in the syntax “$($_.fullname) xxx”, you say to powershell that the string between ( and ) is a powershell command to execute before putting the result in the string.
IMHO the plural “s” is very easy to miss. That’s why I usually use for names for arrays something with the ending “$...List” … in this case it would be $ItemList … and it fits to the PowerShell rule only to use singular names.