For some unknown reason, the devs included "curl" as an alias for Invoke-WebRequest, even though it is not compatible with the proper implementation of curl, which means it gets in the way when I try to make a curl request. I can remove the alias using Remove-Item alias:curl, but next time I start Powershell, the alias has returned. Is there a way to remove it permanently without having to run a script every time I start?

  • 1
    just FYI: I have issued same command Remove-Item alias:curl inside windows server 2019 and it's does not appear again even after restaring Feb 21, 2019 at 10:38
  • @matsonkepson that worked.
    – JayRizzo
    Apr 22, 2020 at 20:02

5 Answers 5


Skip this step if you already have a Powershell profile:

New-Item $profile -force -itemtype file

Then edit your profile:

notepad $profile

Add the following line to it:

remove-item alias:curl

Save, close notepad and reload the profile with the command below or close and open Powershell to apply the profile:

. $profile
  • 2
    Thanks. I must say it's annoying that the powershell developers didn't think this through, forcing us to now have to work around the issue in this way. Mar 17, 2015 at 2:12
  • I don't think it's meant to be a 1:1 replacement. Powershell focuses on an overarching use of a defined set of parameters and automatic parameter binding (which is really great once you get into it). Providing the curl alias is to show folks accustomed to *nix that there is a curl equivalent in Powershell.
    – megamorf
    Mar 17, 2015 at 7:32
  • 1
    The first step can always be skipped. I just did, and got a pop-up asking if I wanted to create the file.
    – np8
    Aug 23, 2017 at 17:12
  • FYI: For some aliases, you will need to append "-Force" May 1, 2018 at 18:40
  • The "funny" thing is that even azure docs show curl commands to quickly test out thing. Real curl commands, not Invoke-WebRequest syntax... Oct 4, 2018 at 12:53

I'd stick with using curl.exe instead of just curl. This approach doesn't rely on PowerShell running with particular profile (and PowerShell could be run with no profile at all using -NoProfile switch).


add Remove-Item alias:cur to powershell autorun script

above XP,2003:



%USERPROFILE%\My Documents\msh\profile.msh
%USERPROFILE%\My Documents\msh\Microsoft.Management.Automation.msh_profile.msh

Is there a way to remove it permanently without having to run a script every time I start?

Technically, no. However, you can utilize the built-in PowerShell Profiles, which runs a script every time you load up PowerShell, to do it for you. But, at least it's not manual.

This is (part) of what I added to my $profile.AllUsersAllHosts file. It is similar to megamorf's answer but slightly more expansive.

Remove-Item alias:curl
Set-Alias curl "${env:SystemRoot}\System32\curl.exe"
Set-Alias wcurl Invoke-WebRequest

You can do this with any of the 6 Powershell profile files, but I'm the only one who uses my desktop, and I see no harm in changing it up a little. If you're not, then go with a different one with a smaller scope. The default $Profile is CurrentUserCurrentHost, so that can't hurt, I'll do the rest of it with that in mind, just substitute the code for whichever one you're changing.

Open a PowerShell terminal, as an Administrator if you can, but I'm fairly certain that the default, CurrentUSerCurrentHost, does not require admin privileges.

Then run:

if (!(Test-Path -Path $profile.currentusercurrenthost)) {
  New-Item -ItemType File -Path $profile.currentusercurrenthost -Force

Then run notepad $profile.currentusercurrenthost

That will check to see if the file exists, if it does not, it will create the file. Then the second command will then open it with notepad.

Note: If you have VSCode or Notepad++ installed, you can open it with VSCode by typing code $profile.currentusercurrenthost instead of notepad. For notepad++ run the command Set-Alias npp "${Env:ProgramFiles}\Notepad++\notepad++.exe" to temporarily create an alias for Notepad++. That way, you can simply type npp $profile.currentusercurrenthost, and it'll open in notepad++. It's similar with other file editors. You can also add this to your profile as well if you'd like that to be permanent.

Then add the lines as you see fit, though this first one must be first.
Remove-Item alias:curl will simply remove the existing alias curl has for Invoke-WebRequest every time you open a powershell prompt. Set-Alias curl "${env:SystemRoot}\System32\curl.exe" sets curl to be an alias for curl.exe which is the actual cURL. It's included in Windows 10 Build 17063 and later.

I also chose to add an alias for the original Invoke-WebRequest, calling it wcurl, with Set-Alias wcurl Invoke-WebRequest as there may be situations when I want to use it, and don't want to type out the long string there.

So, in order, that is:

  1. Remove-Item alias:curl
  2. Set-Alias curl "${env:SystemRoot}\System32\curl.exe"
  3. Set-Alias wcurl Invoke-WebRequest
  4. Set-Alias npp "${Env:ProgramFiles}\Notepad++\notepad++.exe"

Everything after #1 is optional, and the order after #1 does not matter, but #1 must be before #2, or any attempts to create an alias named curl.

If this is a brand new profile, it will be blank upon opening it, and you can add them (in order) if you want them or not. If it's not blank, I would recommend adding it towards the end, if not the end. Personally, my $Profile ends with

pwsh -v

which clears the screen from the various operations it does upon boot, and shows the PowerShell version.


Just add this to your powershell profile:

notepad $profile

if(Test-Path -Path alias:curl) { Remove-Item alias:curl }

Windows Powershell has this default curl alias, but Powershell Core doesn't.
If you want your profile useable for both, you should add Test-Path before remove.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.