Remove alias in script

The following seems to work

If (Test-Path Alias:wget) {Remove-Item Alias:wget}
If (Test-Path Alias:wget) {Remove-Item Alias:wget}
wget

The first line removes the Script level alias, and the second removes the Global level alias. Note that both need to be tested, because if the Global doesn’t exist the Script isn’t created.

Also this misbehaves in that it modifies the parent without being dot sourced.

Alternatively you can just dot source your original and that would work

. .\wget.ps1

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)