How to supply console input ( yes / no ) as part of batch file on Windows.
Do rmdir /S
for deleting a non-empty directory and do rmdir /Q
for not prompting. Combine to rmdir /S /Q
for quietly delete non-empty directories.
Use rmdir /S /Q modules
/Q
suppresses the confirmation prompt.
As others have pointed out, you should use the /Q
option. But there is another "old school" way to do it that was used back in the day when commands did not have options to suppress confirmation messages. Simply ECHO the needed response and pipe the value into the command.
echo y|rmdir /s modules
I recommend using the /Q
option instead, but the pipe technique might be important if you ever run into a command that does not provide an option to suppress confirmation messages.
Note - This technique only works if the command reads the input from stdin, as is always the case with cmd.exe internal commands. But this may not be true for some external commands.