fr33thytweaks / Ultimate-Windows-Optimization-Guide

181 stars 16 forks source link

`7-Zip` Change from manual URL to auto URL which returns latest #14

Closed Obegg closed 3 days ago

Obegg commented 1 month ago

I noticed most of the scripts of relay on 7-Zip use a URL which you have to manually keep up-to-date, for example here: https://github.com/fr33thytweaks/Ultimate-Windows-Optimization-Guide/blob/11f80fdb98fec74b2e342c2e1825b5556bb790e0/5%20Graphics/4%20Nvidia%20Driver.ps1#L73 But this is one example and it appears all across this project.

Here is a better method:

$dlurl = 'https://7-zip.org/' + (Invoke-WebRequest -UseBasicParsing -Uri 'https://7-zip.org/' | Select-Object -ExpandProperty Links | Where-Object { ($_.outerHTML -match 'Download') -and ($_.href -like 'a/*') -and ($_.href -like '*-x64.exe') } | Select-Object -First 1 | Select-Object -ExpandProperty href)
$installerPath = Join-Path $env:TEMP (Split-Path $dlurl -Leaf)
fr33thytweaks commented 3 days ago

once again over complicating it if 7zip change the website layout, so ill just manually keep 7zip updated or i will be using github to download some of these instead. thankyou