Saving a PowerShell command for later use

Let’s suppose the following. You are working with PowerShell console and just finished typing a long and complex command. This second it occurs to you, that you forgot to define a variable, create a remote session or something else. You delete the command, execute some required actions, and type the command again.

Sounds familiar?

In this article we will talk about some techniques, that can help us out.

Continue reading

PowerShell command history

PowerShell keeps the history of executed commands.

PowerShell itself keeps them in memory. In addition to this, the PSReadline module saves them in a file on the hard drive. that allows us to go back to command entered not only in the current session, but also executed some time ago and probably in different PowerShell version.

Continue reading