cmd last commands code example
Example: 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"