I want to replace all space characters into \"_\" in names of all subfolders and files. Unfortunately when I type:
Get-ChildItem -recurse -name | ForEach-Obj
Don't use the Name switch, it outputs only the names of the objects, not their full path. Try this:
Get-ChildItem -Recurse | ` Where-Object {$_.Name -match ' '} | ` Rename-Item -NewName { $_.Name -replace ' ','_' }