Forum Home
Press F1
 
Thread ID: 35361 2003-07-10 03:44:00 Help with a batch file Caesius (3758) Press F1
Post ID Timestamp Content User
158614 2003-07-10 03:44:00 I've made a .bat file to run on startup;

@echo off
cd\
cd windows\temp
del *.* /y
cd\

As many of you will be able to see immedialtely, this presents a very frustrating problem. I get prompted with a Y/N if I want to delete or not.

Is there a way around this to make it do it without asking?

Cheers
Caesius (3758)
158615 2003-07-10 03:50:00 I created a file with a Y in it. Then pointed it to the command.

e.g. del *.* <y.txt

Try that.
KiwiTT (4082)
158616 2003-07-10 03:55:00 DEL [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names
ERASE [/P] [/F] [/S] [/Q] [/A[[:]attributes]] names

names Specifies a list of one or more files or directories.
Wildcards may be used to delete multiple files. If a
directory is specified, all files within the directory
will be deleted.

/P Prompts for confirmation before deleting each file.
/F Force deleting of read-only files.
/S Delete specified files from all subdirectories.
/Q Quiet mode, do not ask if ok to delete on global wildcard
/A Selects files to delete based on attributes
attributes R Read-only files S System files
H Hidden files A Files ready for archiving
- Prefix meaning not

If Command Extensions are enabled DEL and ERASE change as follows:

The display semantics of the /S switch are reversed in that it shows
you only the files that are deleted, not the ones it could not find.



As you can see above, using /Q should help.
godfather (25)
158617 2003-07-10 03:58:00 Try using "deltree /y *.*" instead. It has the side affect of also deleting any directorys there as well.

Otherwise a simpler version of kiwitt's idea would be:

echo y | del *.*

It saves the need of a seperate file.
bmason (508)
158618 2003-07-10 04:02:00 Is that the NT version of DEL gf?

The dos/win9x version only has /P.
bmason (508)
158619 2003-07-10 04:05:00 Yes, XP version (straight from del /?) godfather (25)
158620 2003-07-10 05:35:00 I'd go for deltree /y, with an extra line to replace the \tmp directory to save arguments with programmes which have to have it.
But sometimes after a crash you don't want the contents of \tmp deteted. It might hold essential stuff. Such automatic deletions always cause tears sooner or later. :D Some intentional deletions cause tears, too. :_|
Graham L (2)
1