Using $$, $^, $?
As requested by some of the attendees of my user group, here are some example on how to use $$
, $^
, $?
$$
Contains the last token in the last line received by the current session.
Get-ChildItem -path "c:\windows\" -filter "*.log"
$$
Returns: *.log
$^
Contains the first token in the last line received by the session.
Get-ChildItem -path "c:\windows\" -filter "*.log"
$^
Returns: Get-ChildItem
$?
Contains the execution status of the last operation. It contains TRUE
if the last operation succeeded and FALSE
if it failed.
Get-ChildItem -path "c:\windows\" -filter "*.log"
$?
Returns: True
Leave a comment