Every time I run a script, I need to remove the curl alias from PowerShell in order to use the actual curl which is installed on my machine.
From PowerShell, I can remove the alias perfectly fine by using: Remove-Item alias:curl
But for some reason, when I put this code into a ps1 script and run that script, the alias is not removed.
Does anyone know why this is the case?
You can also update your profile to remove the alias each time PowerShell starts; $profile
is an automatic variable that stores the paths to the PowerShell profiles that are available in the current session.
if (!(Test-Path -Path $profile)) {
New-Item -Path $profile -Force
}
Add-Content -Path $profile -Value "Remove-Item alias:curl"
. $profile
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.