How to reuse commands in PowerShell

Sometimes you have a repetitive tasks in PowerShell, for example purging emails in Exchange, or maybe you just wanted to polish or correct a command you wrote.

There are some different ways to do so:

1. Arrow Up and Arrow Down, press those keys to scroll up or down in your command history and select the desired command to work with.

2. Using F5 and F8 you are able to the same as above (arrows keys).

3. Using F7 and then scrolling up or down using arrow up and down to select the command into the history list. This option is my favorite. With F9 you can enable the numbers if you want to use a number stead of press enter.

With (Alt)+(F7) you can clear the command history and start from scratch.

In addition, the command history only keeps 50 commands by default, but you can modify this value in your profile.

I hope these tips can help you in your day-to-day.

Best regards.

Tony Gonzalez.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s