powershell - Remove alias in script -
i can remove alias so
remove-item alias:wget then trying alias gives expected result
ps > wget wget : term 'wget' not recognized name of cmdlet, function, script file, or operable program. however if set same script
ps > cat wget.ps1 remove-item alias:wget wget it gives unexpected result
cmdlet invoke-webrequest @ command pipeline position 1 supply values next parameters: uri:
the next seems work
if (test-path alias:wget) {remove-item alias:wget} if (test-path alias:wget) {remove-item alias:wget} wget the first time removes script level alias, sec removes global level alias. note both need tested, because if global doesn't exist script isn't created.
also misbehaves in modifies parent without beingness dot sourced.
alternatively can dot source original , work
. .\wget.ps1 powershell
No comments:
Post a Comment