The KEYSTACK command overcomes two weaknesses of input redirection:
1) some programs ignore standard input and read the keyboard through Windows APIs, and
2) input redirection doesn't end until the program or command terminates. You can't, for example, use redirection to send the first few commands to a program and then type the rest of the commands yourself. But KEYSTACK lets you do exactly that.
KEYSTACK sends keystrokes to an application program. Once the KEYSTACK buffer is empty, the program will receive the rest of its input from the keyboard. KEYSTACK is useful when you want a program to take certain actions automatically when it starts. It is most often used in batch files and aliases.
To place the letters, digits, and punctuation marks you would normally type for your program into the KEYSTACK buffer, enclose them in double quotes:
Many other keys can be entered into the Keystack using their names. This example puts the F1 key followed by the Enter key in the KEYSTACK:
keystack F1 Enter
See Keys and Key names for details on how key names are entered. See the KEYSTACK command for information on using numeric key values along with or instead of key names, and other details about using the Keystack.
You must activate the window for the program that will receive the characters before you place them into the Keystack. See KEYSTACK for additional details; see ACTIVATE for information on activating a specific window.