国外找到一个函数, 但是只有一个链接有结果, 而且结果也不对
- Function Get-RedirectedUrl
- {
- Param (
- [Parameter(Mandatory = $true)]
- [String]$URL
- )
-
- $request = [System.Net.WebRequest]::Create($url)
- $request.AllowAutoRedirect = $false
- $response = $request.GetResponse()
-
- If ($response.StatusCode -eq "Found")
- {
- $response.GetResponseHeader("Location")
- }
- }
- [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
- Get-RedirectedUrl "https://www.kugou.com/mixsong/29008597.html"
- Get-RedirectedUrl "http://go.microsoft.com/fwlink/?LinkID=113392"
复制代码 |