PowerShell - How do I call a cmdlet in a function when overriding that cmdlet's name with the same name as the function?

后端 未结 3 1806
无人及你
无人及你 2020-12-29 13:30

So I have a cmdlet named update-name that I have no access to change.

I have created a function named update-name (the same name as the cmdlet). How do I call the c

3条回答
  •  忘掉有多难
    2020-12-29 14:24

    This will do the trick as well - thanks Keith Dahlby! http://twitter.com/dahlbyk/status/55341994817503232

    $unName=Get-Command 'Update-Name' -CommandType Cmdlet;
    
    function update-name {
      & $unName
    }
    

提交回复
热议问题