Q. I have a command that I'm trying to automate that requires a key to be pressed. What can I do?

John Savill

March 5, 2010

1 Min Read
ITPro Today logo in a gray background | ITPro Today

A. The easiest way to handle commands that require user input and don't support command line switches is to simply pipe the required character to the command. For example, if I need to press y, I could do the following:

cmd /c call ECHO Y | command.exe

About the Author

Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like