Home > other >  Powershell run a setup executable from repository
Powershell run a setup executable from repository

Time:09-29

I am trying to create a script which executes a setup executable from a git hub repository, is that possible without downloading the file?

Link to the repository: https://github.com/rarehalf/Smartmontools

CodePudding user response:

You can use Invoke-WebRequest with -OutFile parameter.

Invoke-WebRequest 

it will download the file from GitHub and put it into what ever directory you are currently in, so for you it would be

Invoke-WebRequest https://github.com/rarehalf/Smartmontools/raw/main/smartmontools-7.2-1.win32-setup.exe -OutFile "smartmontools-7.2-1.win32-setup.exe"

you can then call this in your script and run using the below

.\smartmontools-7.2-1.win32-setup.exe
  • Related