PowerShell: Is there an automatic variable for the last execution result?

前端 未结 10 1896
名媛妹妹
名媛妹妹 2021-02-05 00:29

I\'m looking for a feature comparable to Python interactive shell\'s \"_\" variable. In PowerShell I want something like this:

> Get-Something # this returns          


        
10条回答
  •  旧时难觅i
    2021-02-05 01:08

    No there is not automatic variable like that.

    You have to do:

    $output = Get-Something
    $output
    $anObj = $output
    

    to get the behaviour

提交回复
热议问题