从PowerShell网站上获取最新的下载URL和软件版本
我想采用该软件的最新版本,并检查系统上安装的版本,如果它是较新的安装新版本。
'''$ web = invoke-webrequest -uri“ https://www.webex.com/downloads/jabber/jabber/jabber-vdi.html” ($最新= $ web。
以获取我写的版本编号和URL,但不起作用
''($最终= $最终。 ($ downloadurl = $最终。
我也尝试过这种方式,但不起作用
'''$最新verathsversion = $最终.links.href''''
I want to take the take the latest version of the software and check with the version that is installed on system if it is newer install the new version .
''' $web = Invoke-WebRequest -Uri "https://www.webex.com/downloads/jabber/jabber-vdi.html"
( $latest = $web.AllElements | Where-Object {$_.TagName -eq "li"} | Select-String "Jabber Windows client" | Select -first 1 )'''
for taking the version number and url I've wrote these but does not work
''' ( $latestversion = $latest.Context | Select-String -pattern "\d\d.\d")
( $downloadUrl=$latest.Context | Select-String -pattern "\w.msi" )'''
also I have tried this way but does not work
'''$latestversion = $latest.links.href '''
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用链接属性来查看所有检索到的链接,然后过滤以选择“ MSI”
编辑结束的链接:要获得两者,也可以使用parsedhtml,例如:
$匹配
是一个自动变量,是一个自动变量,包含-match
REGEX的结果。比赛中的括号定义了我们的比赛组,因此对于的等级,“< li>(\ d {1,2} \。\。\ d)。*(https。*msi)”
:我们的第一个匹配是
(\ d {1,2} \。\ d)
其中\ d
是任何数字,{1,2}表示匹配1或2(因此,我们可以匹配“ 9”或“ 10”),\。
从字面上匹配DOT字符,我们的第二个匹配是
(https。*msi)
其中。 /code>匹配任何字符,
*
表示匹配任何数量的事件。You can use the Links property to view all retrieved links, then filter it to select only those ending with "msi"
edit: to get both, maybe use ParsedHtml like so:
$Matches
is an automatic variable which contains the result of the-match
regex. The brackets in the match define our match groups, so for our regex of"<LI>(\d{1,2}\.\d).*(https.*msi)"
:Our first match is
(\d{1,2}\.\d)
where\d
is any number and {1,2} means match either 1 or 2 (so we could match "9" or "10"),\.
matches the dot character literallyOur second match is
(https.*msi)
where.
matches any character and*
means match any number of occurances.