hakk

software development, devops, and stuff
Tree lined path

Windows

Download a file from the web using PowerShell

The Invoke-WebRequest command in PowerShell is very powerful and can be used to do much more then downloading a file. Check out the Invoke-WebRequest documentation page to learn more. Download a file from the web (http, https) Invoke-WebRequest -Uri "http://192.168.100.123:3000/myzipfile.zip" -OutFile "C:\Documents\myzipfile.zip" The above command well download a file from the web (in this case a local ip address) and save if under your Documents folder. Need to Extract a zip file? Read more...

How to unzip a file in PowerShell?

Have a .zip file and need to extract its entire contents using Powershell? No problem, it’s built in! Since PowerShell version 5+, there is an Expand-Archive command built in: Expand-Archive -Path myzipfile.zip -DestinationPath C:\extract\to\here Not sure which version of PowerShell you have? $PSVersionTable.PSVersion Find more information: man Expand-Archive Need to Create a zip file? Check out Compress-Archive in PowerShell

How to zip file(s) in PowerShell?

Have some files and need to create a zip archive using Powershell? No problem, it’s built in! Since PowerShell version 5+, there is an Compress-Archive command built in: Compress-Archive running in PowerShell Compress-Archive -Path file.txt, file2.txt -CompressionLevel Fastest -DestinationPath C:\compress\to\here\myzipfile.zip Note: There’s a 2 GB max file size limit due to a limitation of the underlying API. Not sure which version of PowerShell you have? Read more...