How to save recent commands you have run in the windows command prompt

How to save recent commands you have run in the windows command prompt

I recently had a scenario where I'd run a moderately complex series of commands in the windows command prompt, and I wanted to keep a record of exactly what I'd done so that I could repeat it in the future if necessary. Happily, there is a command which will put all your recent commands on the clipboard so you can paste them wherever you keep your records.

It's as simple as running this command:

doskey /history | clip

Running doskey /history will list all commands you've run in your current session, and | clip will pipe the list to your clipboard instead of displaying it in the command prompt.