Blogging for my own purposes.
To create a batch program named Tmp.bat that contains recently used commands, type:doskey /history > tmp.bat