Discussion Locked

Batch File Asks User for Y or N

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

In my batch file, in the process of doing what it does, I want to have it ask the user if they want to delete all folders (under the current folder that is) that start with "bak". So the command will delete all bak* folders if they hit Y, and if they hit N it will continue on with the rest of the script and not delete anything.
I have been searching for an hour but am tired tonight. Any ideas how I can do this? Thanks.
Oh, this batch is for 2000 and XP systems if that matters.
Thank you.

5 replies

by borginva

What if the PCs do not have CHOICE as it seems to be part of some resource kit. I have a thousand PCs and I am sure CHOICE is not on all of them.
Thanks.

by roger

You can copy choice.com from any computer that it is on to any other computer.

by bottomb

This is for an automatic answer of "yes" to the delete command in a batch file:

In the Batch file:
del *.* < C:\y.txt

The text file:
Y

Put the txt file in root of c:

When the txt file is redirected to the bat file it enters the Y and the enter command.

Thanx, Bert

This discussion is closed to new replies.