【发布时间】:2022-08-03 18:27:28
【问题描述】:
我想访问我使用 PowerShell (https://repo.anaconda.com/archive/Anaconda3-2022.05-Windows-x86_64.exe) 检索的 URL 的不同部分,-match 返回 true,第一个匹配是我可以正确获取的日期,第二部分是文件的名称 (Anaconda3- 2022.05-Windows-x86_64.exe) 我无法得到它, 有人可以帮我吗,在此先感谢 这是我的脚本
$Uri = \'https://www.anaconda.com/products/distribution#Downloads\'
( $web = Invoke-WebRequest -Uri $uri)
( $downloadurl=$web.Links |Where-Object href -Like \"*_64.exe\" |Select-Object -First 1 | Select-Object -expand href )
( $downloadurl -match \"(\\d\\d\\d\\d.\\d{1,2}).*(Anaconda*.exe)\" )
($latestversion = \"$($Matches[1])\")
($FileName = \"$($Matches[2])\")
标签: powershell pattern-matching string-matching invoke-webrequest