utils: Make build.ps1 work with PowerShell Core
Windows PowerShell (version 5) and PowerShell Core (versions 6+) do not
handle escaping parameters for external programs invocation in the same
manner. In order to keep the script compatible with both editions of
PowerShell, these changes use the appropriate quote escaping style
depending on the PowerShell edition.
This also clears out the progress bars that can ghost in following a
call to `Remove-Item` in PowerShell Core.