Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Reverting Clear-Host command in Powershell [closed]

Tags:

powershell

I ran the cls alias for Clear-Host in my Powershell ISE session which cleared all output I received in my console from previous commands,

Is it possible for me to retrieve host history and revert the previously run Clear-Host behavior on my console?

like image 218
scharette Avatar asked May 08 '26 12:05

scharette


1 Answers

While it won't give you the output of the commands, you can use Get-History to get a list of the commands used in the current session.

For more information on each command you can pipe it into Format-List like so:

> Get-History | Format-List -Property *


Id                 : 1
CommandLine        : Get-History
ExecutionStatus    : Completed
StartExecutionTime : 7/18/2018 12:07:11 PM
EndExecutionTime   : 7/18/2018 12:07:11 PM

Id                 : 2
CommandLine        : echo Hello
ExecutionStatus    : Completed
StartExecutionTime : 7/18/2018 12:07:18 PM
EndExecutionTime   : 7/18/2018 12:07:18 PM

Id                 : 3
CommandLine        : Get-History
ExecutionStatus    : Completed
StartExecutionTime : 7/18/2018 12:07:26 PM
EndExecutionTime   : 7/18/2018 12:07:26 PM
like image 72
dkneeland Avatar answered May 11 '26 16:05

dkneeland