Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DavidMetcalfe/09ad4a7a5bf1b6be37dfd10d9353cdd8 to your computer and use it in GitHub Desktop.
Save DavidMetcalfe/09ad4a7a5bf1b6be37dfd10d9353cdd8 to your computer and use it in GitHub Desktop.
Escape and unescape URLs in PowerShell
function EscapeURL() {
# Escape the given URL and return it.
param (
[Parameter()]
[string] $URL_To_Escape
)
return [uri]::EscapeDataString($URL_To_Escape)
}
function UnescapeURL() {
# Unescape the given URL and return it.
param (
[Parameter()]
[string] $URL_To_Unescape
)
return [uri]::UnescapeDataString($URL_To_Unescape)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment