Most people have heard of curl
, but on Windows we haven’t always got that to hand. Well, the PowerShell team have thought of that.
If you just want to see whether a particular URL is working it’s as simple as:
$url = 'http://www.google.com/' Invoke-WebRequest $url
They’ve even created curl
as an alias for it. Neat.
Sometimes you’ll want to test against a web app on your intranet that requires credentials. That’s easy, too:
$url = 'http://www.google.com/' $cred = Get-Credential 'domain\username' # Will show dialog asking for password. curl $url -credential $cred
And of course you can perform all the usual lovely PowerShell piping greatness:
1,2,3 | %{ curl 'server$_.mydomain.com' }