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
1 2 3 4 5 6 7 8 | 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
1 | PS D:\> Invoke-History 2 |
Michael