Search code examples
windows-10windows-console

How to read a text file into command line history


I have a .txt file with command line commands on each line. How can I load the contents of this text file back into the "clipboard" or "history" memory of a command prompt session and be able to arrow key up/down through them?

Example of commands and format inside blah.txt:

ipconfig
ipconfig /flushdns
cd C:\blah

Solution

  • Jonathan

    I'm not currently a Windows user, but it looks like this could solve your problem. You'll have to add commands via .csv or .xml, not .txt file though.

    https://msdn.microsoft.com/en-us/powershell/reference/5.1/microsoft.powershell.core/add-history

    Hope this helps.