Feature #781
Using Wget on Windows Server 2012 Core
Status:
Closed
Priority:
Normal
Assignee:
Category:
PowerShell
Target version:
Description
I recently needed to download an archive from the Internet onto a Windows Server 2012 Core machine. This is a simple guide on using wget on Windows Server 2012 Core via PowerShell. Additionally, I will cover compressing and extracting .zip archives using PowerShell
- From the command prompt, open a powershell session:
powershell
- Use wget to download a .zip archive from the Internet:
wget http://www.example.com/someArchive.zip -UseBasicParsing -OutFile someArchive.zip
Compress/Extract Archives¶
NOTE: .NET 4.5 is required for this method to work properly.
- Add the compression type:
Add-Type -A System.IO.Compression.FileSystem
- To compress a directory into a .zip archive:
[IO.Compression.ZipFile]::CreateFromDirectory('someArchive', 'someArchive.zip')
- To extract a .zip archive to a directory:
[IO.Compression.ZipFile]::ExtractToDirectory('someArchive.zip', 'someArchive')