Skip to content

Get RedirectUri on PowerShell

PowerShell で curl -w “%{redirect_url}” 相当がしたくなったのでメモ.

Param(
[String]$Uri
)
$request = Invoke-WebRequest -Method Head -Uri $Uri
$redirectedUri = $request.BaseResponse.ResponseUri.AbsoluteUri
echo $redirectedUri