General discussion

Locked

Delete command in a batch file?

By jim_rau ·
I have a batch file I built with NotePad in Win95 and one of the commands is "del f:\slik-app\data\*.*"

The batch runs fine except that this command requires a confirmation. I am using this as part of an automated process. I need to figure out what is needed in the batch so it does not ask for confirmation.

Any ideas/answers???

This conversation is currently closed to new comments.

12 total posts (Page 1 of 2)   01 | 02   Next
| Thread display: Collapse - | Expand +

All Comments

Collapse -

Delete command in a batch file?

by yorkster In reply to Delete command in a batch ...

use a /Q at the end of your delete statement, the Q is for quite mode.
hope this helps
note: this works in NT but I'm not sure about 95

Collapse -

Delete command in a batch file?

by jim_rau In reply to Delete command in a batch ...

From responses further down it looks like this is NT and up ...

Collapse -

Delete command in a batch file?

by SyscoKid In reply to Delete command in a batch ...

1. Create a text file that contains only the letter "y". Call it y.txt.

2. Change your command to del f:\slik-app\data\*.* <y.txt

Collapse -

Delete command in a batch file?

by jim_rau In reply to Delete command in a batch ...

I remember this ... thanks for the refresher but the echo is a better solution (see below).

Collapse -

Delete command in a batch file?

by James Schroer In reply to Delete command in a batch ...

Try a del /y f:\slik-app\data\*.* or try del f:\slik-app\data\*.* /y If that doesn't work I know for a fact this will. You will have to delete the directory but it will create the directroy back. deltree /y f:\slik-app\data
if not exist f:\slik-app\data\nul md f:\slik-app\data

Collapse -

Delete command in a batch file?

by jim_rau In reply to Delete command in a batch ...

So I would have to add more lines to put the folder back ... but the echo idea below is much better and the one above is OK too ...

Collapse -

Delete command in a batch file?

by SyscoKid In reply to Delete command in a batch ...

I know for a fact mine works, but I think you might need a hard return after the letter y.

Collapse -

Delete command in a batch file?

by jim_rau In reply to Delete command in a batch ...
Collapse -

Delete command in a batch file?

by jeng In reply to Delete command in a batch ...

Comment on #1: DEL F:\slip-app\data /y only works for NT

On #2: This will work. You can bypass the creation of a "Y" file by doing "echo Y | DEL F:\slip-app\data". This will work with any version of DOS (of at least DOS 5.0).

On #3: Becareful with DELTREE. It will do the deletion, but it will take out the subdirectories below it. After deleting the files, it will remove the subdirectory "F:\slip-app\data" itself. This is only available in Win9x. For NT, use "RD /S /Y"

Collapse -

Delete command in a batch file?

by jim_rau In reply to Delete command in a batch ...

You the MAN! What is best about this is I don't need a text file to implement the idea, it kind of works wherever it is. Thanks!!!

Back to Windows Forum
12 total posts (Page 1 of 2)   01 | 02   Next

Related Discussions

Related Forums