cURL and Wget alternatives for Windows Command Prompt with PowershellSome great Powershell alternatives to the Linux GNU Wget and cURL type command-line utilities using the System.Net namespace

Today I had to find a way to execute a repeatable series of HTTP requests addressed to a Web Server from a Windows 10 machine.

If it were a Linux OS, I could’ve used cURL from a Terminal window in the following one-liner:

1

>curl http://www.mysite.com/

Unfortunately, there’s nothin close to cURL in Windows, except for the BITSAdmin Tool – a command-line tool that you can use to create download or upload jobs and monitor their progress. However, BITSAdmin is designed to work with jobs and tasks, meaning that you have to create a job first, then append one or more tasks to it – which I found to be overkill for my current scenario.

Luckily enough there is a quicker alternative, thanks to the System.Net.WebClient class that can be invoked using Powershell.

cURL

All we need to do is to create a cURL.ps1 file and fill it with the following contents:

Wget

Ignore SSL warnings

In the unlikely scenario that we need to send our request(s) to a HTTPS website with an invalid certificate – which could easily be the case for locally-hosted resources, as they often rely to a self-signed certificate – we can use the ServicePointManager.ServerCertificateValidationCallback property provided by the System.Net namespace to disable the SSL trust requirements.

This can be done by adding the following line to any of our previous commands:

About Ryan

IT Project Manager, Web Interface Architect and Lead Developer for many high-traffic web sites & services hosted in Italy and Europe. Since 2010 it's also a lead designer for many App and games for Android, iOS and Windows Phone mobile devices for a number of italian companies.

This site uses cookies to improve user experience, personalize content & ads, provide social media features and analyze our traffic: some of these info are shared with our social media, advertising and analytics partners. We assume you're okay with this, but you can opt-out if you wish. Read the Privacy Policy for further info.