English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

How can i automatically make a batch file delete files without having to type the y and hit enter

2007-10-04 17:59:29 · 3 answers · asked by kinggeek73 2 in Computers & Internet Other - Computers

3 answers

The easiest way is to use a couple of the built-in switches on the "del" command.

/q = Quiet mode, do not ask if ok to delete on global wildcard

/f = Force deleting of read-only files.

/s = Force deleting of read-only files.

================================
PROCEED WITH EXTREME CAUTION!
================================
Test this in a temp or test directory before actually using. It will delete all files in the directory structure without prompting.

del . /q /f /s

2007-10-06 15:20:55 · answer #1 · answered by Kevin 7 · 4 0

To delete all files from a directory, you could use:

DEL *.*

DEL will then ask you to confirm that you want to delete all files.

In batch files, this would stop the execution of the batch file and require user interaction, which usually isn't what batch files are intended for.

One way to solve this would be:

ECHO Y | DEL *.*

which will work fine for English DOS versions; for other languages the "Y" needs to be replaced.
So what if you don't know what language will be used for your batch file?
Try this:

FOR %%A IN (*.*) DO DEL %%A

This solution is completely indepent of both operating system and language!

2007-10-04 18:12:35 · answer #2 · answered by Anonymous · 0 0

HAHA! This screams "mean comedian tale" to me. humorous which you recognize adequate that a batch record would be a area of it, yet do not understand the thank you to place in writing it :) Secondly, with the working device up and working, it's going to be close to impossible to delete the itemizing. good success figuring it out. i desire whoever you're doing this to catches you.

2016-10-21 02:30:13 · answer #3 · answered by ? 4 · 0 0

fedest.com, questions and answers