PowerShell: Rename Files, Space to Lowline 📜
Functions to rename file from space to lowline _.
function xah-rename-file-space-to-lowline { # .DESCRIPTION # pipe files to this function to rename it. # .EXAMPLE # dir | xah-rename-file-space-to-lowline # .NOTES # Created: 2023-03-01 # Version: 2025-04-03 # .LINK # http://xahlee.info/powershell/powershell_rename_file_space_to_lowline.html process { if ($_ ) { if ($_.name.contains(" ")) { $newname = $_.name.replace(" ", "_") Write-Host ($_.name , " →`n$newname") Rename-Item $_ $newname } } else { Write-Host 'no input. pipe file to me.' } } }