Windows: Working with the powershell command history

Hi,

like the UNIX bash shell, the Windows powershell also has a history which commands were executed.


Get-History is the command let you need, or simply call the history alias

PS D:\> history 

  Id CommandLine
  -- -----------
   1 cd \
   2 Get-Item $ENV:TEMP
   3 mkdir $ENV:TEMP\myTempFolder
   4 alias history

To recall an already executed command use Invoke-History and as parameter the Id

PS D:\> Invoke-History 2

Michael

Leave a Reply