Jump to content

How to automatically download and launch files?

Helpful Tech Witch

After reinstalling windows today, I realised that I need to get a way to automatically get a the files I need (drivers, game launchers, etc) and launch them. 

I know id need to use whatever windows uses for wget, and whatever the equivalent to && is (can you tell I only use Linux shell?), But I don't know the way I'd go about this.

Also, is CMD file the best way to do this? Batch?

I could use some help with this!

please, pm me if you would like to contribute to my gpu bios database (includes overclocking bios, stock bios, and upgrades to gpus via modding)

Bios database

My beautiful, but not that powerful, main PC:

prior build:

Spoiler

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

does this look like it will do the trick?

$url = "https://download.msi.com/dvr_exe/intel_chipset_9.zip"
$output = "c:\users\urban\Downloads\chipset.zip"
$start_time = Get-Date

Invoke-WebRequest -Uri $url -OutFile $output
Write-Output "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
cd C:\Users\urban\Downloads
Expand-Archive -Path chipset.zip -DestinationPath c:\users\urban\Downloads\chipset
cd "\Users\urban\Downloads\chipset\Intel 10.1.1.45\"
start SetupChipset.exe

its to download and start the chipset driver installer

 

 

now, can I get it to approve the admin perms for a file that requires them?

I could use some help with this!

please, pm me if you would like to contribute to my gpu bios database (includes overclocking bios, stock bios, and upgrades to gpus via modding)

Bios database

My beautiful, but not that powerful, main PC:

prior build:

Spoiler

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Maybe 

if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
{  
  $arguments = "& '" +$myinvocation.mycommand.definition + "'"
  Start-Process powershell -Verb runAs -ArgumentList $arguments
  Exit
}

 

Source: https://stackoverflow.com/a/66796707/12280200

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Forbidden Wafer said:

Maybe 


if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator"))  
{  
  $arguments = "& '" +$myinvocation.mycommand.definition + "'"
  Start-Process powershell -Verb runAs -ArgumentList $arguments
  Exit
}

 

Source: https://stackoverflow.com/a/66796707/12280200

I actually was able to figure is out.

I had to launch it as administrator, then I had to disable the protections for powershell .PS1 scripts (I ligitamatly thought that was a form of ROM file for the psx).

I was then able to run it, and it ran the chrome setup as if there was no admin perms required.

Im actually able to get everything as the newest versions on the download script, except for the amd drivers. I'll have to scrape the link from the driver download page, they don't just auto download the latest from a gereneric link like everything else I have.

Any guess on how to do that?

I could use some help with this!

please, pm me if you would like to contribute to my gpu bios database (includes overclocking bios, stock bios, and upgrades to gpus via modding)

Bios database

My beautiful, but not that powerful, main PC:

prior build:

Spoiler

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, HelpfulTechWizard said:

I'll have to scrape the link from the driver download page, they don't just auto download the latest from a gereneric link like everything else I have.

Any guess on how to do that?

With powershell? No idea. 😕

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Forbidden Wafer said:

With powershell? No idea. 😕

Yeah. It probably can be done with the all powerful Invoke-WebRequest command. It seems to do everything.

I could use some help with this!

please, pm me if you would like to contribute to my gpu bios database (includes overclocking bios, stock bios, and upgrades to gpus via modding)

Bios database

My beautiful, but not that powerful, main PC:

prior build:

Spoiler

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Please use PowerShell core (7+) https://github.com/PowerShell/PowerShell its open source and much more ergonomic and maintained.

 

If I were you I would use a tool like SCOOP to maintain package versions and updates. See docs about creating your own custom "bucket" (git hub repo with scoop packages) 

 

About the AMD thing, you sure its just a question of scraping an static HTML? You sure there isn't any JS generating a custom link after accepting EULA something like that? If there is, you might need something like a https://github.com/microsoft/playwright script or something.

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, samuelhnrq said:

Please use PowerShell core (7+) https://github.com/PowerShell/PowerShell its open source and much more ergonomic and maintained.

 

If I were you I would use a tool like SCOOP to maintain package versions and updates. See docs about creating your own custom "bucket" (git hub repo with scoop packages) 

 

About the AMD thing, you sure its just a question of scraping an static HTML? You sure there isn't any JS generating a custom link after accepting EULA something like that? If there is, you might need something like a https://github.com/microsoft/playwright script or something.

I actually have it figured out. I can use invoke webrequest to do it, I’ve got it all working except for Amd rn.

Amd I’ve actually got it to save the link by doing a certain script with .links.href, and saving it to a string, but invoke we request can’t parse the link

I could use some help with this!

please, pm me if you would like to contribute to my gpu bios database (includes overclocking bios, stock bios, and upgrades to gpus via modding)

Bios database

My beautiful, but not that powerful, main PC:

prior build:

Spoiler

 

 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×