Skip to content

Instantly share code, notes, and snippets.

@lfalck
Last active April 3, 2023 09:11
Show Gist options
  • Save lfalck/fbb04ef438b521064e0c5742bcd28c2f to your computer and use it in GitHub Desktop.
Save lfalck/fbb04ef438b521064e0c5742bcd28c2f to your computer and use it in GitHub Desktop.
Remove the PowerShell alias curl -> Invoke-WebRequest
# This script will add the Remove-Item alias:curl command to an existing PowerShell profile or create one if it does not exist
# If it is run from PowerShell ISE an ISE profile will be created: Microsoft.PowerShellISE_profile.ps1
# Otherwise a regular profile will be created: Microsoft.PowerShell_profile.ps1
$removeCurlAlias = @"
# Remove Alias curl -> Invoke-WebRequest
Remove-Item alias:curl
"@
if (-Not (Test-Path $Profile))
{
New-Item –Path $Profile –Type File -Value "$removeCurlAlias`r`n"
}
else
{
Add-Content –Path $Profile -Value "`r`n$removeCurlAlias"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment