how to find previous commands in cmd code example

Example 1: grep history in windows

Use doskey in Windows for requesting your command history. For that you first
have to create once a storage file in some directory as follows:
doskey /history > C:/history.txt

Then just use doskey command together with fidstr to filter your history:
doskey /history | findstr "substring"

Example 2: search in history command windows

Yes you can using doskey instead of history in Windows! You only have to first 
create a storage file as:
doskey /h > c:\cmd_history.txt
Then just call your command history and filter your search as follows:
doskey /history | findstr "substring"

Tags:

Misc Example