Okay, the expected \"output\" of this script is fairly obvious, and it works. It copies files:
Get-ChildItem -Recurse -Directory | ForEach-Object{
if ($
PS C:\> Get-Help -Name 'ForEach-Object'
SYNTAX
ForEach-Object [-MemberName] [-ArgumentList
By using a script block, you're using positionally-bound parameters of the ForEach-Object
cmdlet. In this case, the -Process { }
parameter set. If you escape the end of the line (in essence, escaping the newline), you can get around that, but it's generally a bad practice.