How do I replace spaces with %20 in PowerShell? April 6, 2023 by Tarik To replace " " with %20 and / with %2F and so on, do the following: [uri]::EscapeDataString($SitePath)