history command windows code example

Example 1: windows history command

Use doskey! First you have to first create a storage file in a directory as:
doskey /h > c:\cmd_history.txt
Then just call your command history:
doskey /history

Optionally you can filter your history commands searching with findstr:
doskey /history | findstr "substring"

Example 2: history command linux

Highly recommended command to use in terminal for reviewing commands and reuse
some of them. Just execute in terminal:

history

Also recommended to use together with grep for filtering a specific used command

history | grep "foo*"

Example 3: 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"