Skip navigation

How do I automate a response when I enter a command that asks for input?

A. Most commands have a switch to confirm an action. For commands that require a response (e.g., a logon that asks you to enter a password), try the following command.

echo <password> | logon savillj

This command runs the command logon savillj. When the logon command asks for a password, the echo command echos the password with a return, thus entering your password.

You can also use the following code to echo a return.

echo.|cmd.exe
Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish