brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: type curl.exe in Windows PowerShell 5.1 to get the real tool

Windows
~/tips/tip-windows-curl-exe-alias

curl.exe -I https://example.com

Avoid the alias that turns curl into Invoke-WebRequest and breaks copied commands.

You copy a curl command from a README, paste it into Windows PowerShell, and it complains about a parameter it doesn’t know. The command is probably fine. In Windows PowerShell 5.1, curl is a built-in alias for Invoke-WebRequest, which takes different options.

Add the extension and you get the real program that ships with Windows:

curl.exe -I https://example.com

You can check what a bare name points to with:

Get-Command curl

If it reports an alias, that explains the odd errors. You can remove the alias for the current session:

Remove-Item Alias:curl

I’d rather type curl.exe, especially in scripts, because it behaves the same whether or not someone’s profile removed the alias.

PowerShell 7 and later don’t define this alias, so there a plain curl already runs the real thing. Removing the alias in 5.1 only lasts until you close the window, unless you put that line in your profile. Quoting is another trap: commands written for a Linux shell often use backslashes to continue lines, and PowerShell uses a backtick for that, so join the lines first.

Further reading: curl on Windows

More Windows tips Win+Ctrl+C Win+Shift+Left arrow Win+Ctrl+Left arrow Alt+PrtScn Left Alt + Left Shift + Print Screen All Windows tips (33) All topics

Link