efn阿克说 发表于 2018-9-1 12:53:31

Powershell $$,$^,$? 的功能

  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

页: [1]
查看完整版本: Powershell $$,$^,$? 的功能