Removing the PowerShell curl alias?

PowerShell is a spiced up command line shell made by Microsoft. According to some people, it is a really useful and good shell alternative.

Already a long time ago, we got bug reports from confused users who couldn’t use curl from their PowerShell prompts and it didn’t take long until we figured out that Microsoft had added aliases for both curl and wget. The alias had the shell instead invoke its own command called “Invoke-WebRequest” whenever curl or wget was entered. Invoke-WebRequest being PowerShell’s own version of a command line tool for fiddling with URLs.

Invoke-WebRequest is of course not anywhere near similar to neither curl nor wget and it doesn’t support any of the command line options or anything. The aliases really don’t help users. No user who would want the actual curl or wget is helped by these aliases, and users who don’t know about the real curl and wget won’t use the aliases. They were and remain pointless. But they’ve remained a thorn in my side ever since. Me knowing that they are there and confusing users every now and then – not me personally, since I’m not really a Windows guy.

Fast forward to modern days: Microsoft released PowerShell as open source on github yesterday. Without much further ado, I filed a Pull-Request, asking the aliases to be removed. It is a minuscule, 4 line patch. It took way longer to git clone the repo than to make the actual patch and submit the pull request!

It took 34 minutes for them to close the pull request:

“Those aliases have existed for multiple releases, so removing them would be a breaking change.”

To be honest, I didn’t expect them to merge it easily. I figure they added those aliases for a reason back in the day and it seems unlikely that I as an outsider would just make them change that decision just like this out of the blue.

But the story didn’t end there. Obviously more Microsoft people gave the PR some attention and more comments were added. Like this:

“You bring up a great point. We added a number of aliases for Unix commands but if someone has installed those commands on WIndows, those aliases screw them up.

We need to fix this.”

So, maybe it will trigger a change anyway? The story is ongoing…

3 thoughts on “Removing the PowerShell curl alias?”

  1. Perhaps the hacky but backwardly-compatible solution is for the alias to call curl if a curl is present in the path, and otherwise to fulfil the request if it’s simple, or die with an error if command-line options are passed that it doesn’t understand.

    1. Apparently their aliases can also be used in scripts so they’re scared that a certain number of users’ scripts will break if they change them. You wouldn’t want scripts to suddenly act differently just because you install curl.

      Having heuristics based on what command line options that are used could possibly work (I don’t really know the options PowerShell’s “curl” supports) but that would also require them to add checks that are specific for each alias/command which is a lot more work and code than they have for this today.

      IOW: they don’t want their users to get a bad experience while they without must hesitation have induced a bad experience for our users for years.

  2. As a dev that uses linux and windows, I’d say in Powershell I’d like to be able to specify to use cURL if I wish so.

    I think so far no one has thought this way. Microsoft wishes to provide backwards compatibility.. understandable.

    I believe they should provide the end users a choice to configure which library to use to fetch http data to get best of all worlds/platform, today and in the future.

    @gsvolt

    ps: Good PR btw 😉

Comments are closed.