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 run: doskey /history | findstr "substring"