Auto Respond To Windows Command Prompts in Cmd.exe Shell

In Windows Batch Scripting you come across various cases where a command execution halts during processing for confirmation prompt or user acceptance prompt (for example copy command shown below).

 

C:>copy TempTest.INI TempTest-new.INI
Overwrite TempTest-new.INI? (Yes/No/All):
        0 file(s) copied.

C:>

 

In such a case you’d require providing an auto-response to such a prompts, you can achieve this using the echo command as shown below:

 

C:>echo Y | Copy TempTest.INI TempTest-new.INI
        1 file(s) copied.

C:>

Leave a Reply

Your email address will not be published. Required fields are marked *