Roul
Roul

Reputation: 965

Set user input for commands present in a bat file

I'm using command "rmdir" inside a bat file for some automation job. But, this command asks for some user input like remove all directory recursively or not. So, user need to provide set yes or no by typing "y" or "n"

Can I set the user input inside my bat file??? So, that I don't have to enter the option manually each time I run that file.

NOTE: I have some other command which also needs user input. So I'm looking for a generalized solution.

Upvotes: 0

Views: 90

Answers (2)

jeb
jeb

Reputation: 82247

A general solution is to echo the answer through a pipe, like:

echo Y | rmdir /s myDir

Upvotes: 1

Thronghar
Thronghar

Reputation: 467

You could try to run rmdir /q. Source. It runs it in quiet mode.

Upvotes: 1

Related Questions