Skip navigation

JSI Tip 2655. How do I pipe a response to a command in a batch?.

I have piped responses in various batch scripts on this site, but if you were trying to search for the 'how to', you may not find them.

Here are 3 solutions:

1. Some commands have a switch (/Y) which eliminates the prompt. It may not even be documented.

2. Example for responding to a prompt from the output of a command:

    echo y | <command>

3. Example for responding to a prompt with the contents of a text file:

    <command> <DriveLetter:\Folder\filename.txt

Hide 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.