Home > Software design >  What's the equivalent command of streaming (bash) scripts via curl to respective shell on windo
What's the equivalent command of streaming (bash) scripts via curl to respective shell on windo

Time:05-31

For example the below script downloads a script and lets bash execute it:

curl -s -L https://example.com/script.sh | bash

What would be the equivalent to download a https://example.com/script.ps1 powershell script file and let powershell execute it in the same above way bash does?

CodePudding user response:

You can invoke a web request to get the file and then execute it in the pipeline.

. { iwr -useb https://example.com/install.ps1 } | iex; install

In the command above, iwr is shorthand for Invoke-WebRequest and iex is Invoke-Expression

CodePudding user response:

You can use git to clone It and If you are using PowerShell 7 You can make It In one line Like this

git clone https://example.com/script.bat && ./script.bat

This is way You can do It I am sure there are different ways to do It but this Is the way i know I will be happy If this help You.

  • Related