how to search in cmd history code example

Example 1: command line history search

Ctrl+R
 - Start typing a command and the most recent matching command will appear
 - Press Ctrl+R again to cycle through results
 - Press Enter or Tab to select the result

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"