Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 34890

PowerTip: Add Commands to PowerShell History

$
0
0

Summary: Learn how to add commands to your Windows PowerShell command history.

Hey, Scripting Guy! Question I have been working in the Windows PowerShell console all day, and I have several commands I keep running. It requires a lot of up and down arrowing to retrieve them. How can I add them to the my command history?

Hey, Scripting Guy! Answer Use Get-History to retrieve a list of all the commands you have typed. Note the command numbers, then use Get-History, supply the specific command numbers, store the resulting object in a variable, and add the history via the variable:

$a = Get-History 11,12

Add-History $a


Viewing all articles
Browse latest Browse all 34890

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>