https://lazywinadmin.github.io/powershell/2017/06/using_automaticvariable_token.html


$$

包含了你执行指令的最后一部分

 Get-ChildItem -path "c:\windows\" -Filter "*.log"


$$将返回是*.log


$^

将返回的是执行指令的第一部分

$^返回是Get-ChildItem


$?

将返回你指令执行的结果,成功了将是True,失败了将是False



fyi.

PS C:\> Get-ChildItem -path "c:\windows\" -Filter "*.log"



    Directory: C:\windows



Mode                LastWriteTime         Length Name

----                -------------         ------ ----


-a----        9/19/2017   1:48 PM            275 WindowsUpdate.log



PS C:\> $$

*.log

PS C:\> $^

Get-ChildItem

PS C:\> $?

True