?
Solved

DOS BATCH USING DEL needs to auto "yes"

Posted on 1998-06-23
15
Medium Priority
?
3,173 Views
Last Modified: 2013-12-29
I have a line in a DOS BATCH file "If Exist *.* del *.*". I need to automate this delete command so that it will not ask if I want to delete all files in the directory and will not show/echo anything to the screen so that the user is unaware of the delete. NOTE: this is not for a virus but for a build.bat as part of a project :)
0
Comment
Question by:kinkajou
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 4
  • 3
  • +1
15 Comments
 
LVL 7

Expert Comment

by:cmcgee
ID: 1715627
Add the /Q to the statement to stop being prompted Y/N



Craig
0
 
LVL 2

Author Comment

by:kinkajou
ID: 1715628
Thanks Craig, but...

"del /q *.*" or "del /Q *.*" or "erase /Q *.*" or "erase /q *.*" yields: Invalid switch. I am using Windows SR2.1 and Windows 98 ver 4.00.1111 (should be the release version of 98).
0
 
LVL 7

Expert Comment

by:cmcgee
ID: 1715629
the /Q switch needs to be at the end of the statement
For Example

Del *.* /q
del autoexec.bat /q

Give this a try

0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 2

Author Comment

by:kinkajou
ID: 1715630
What I typed and the results:

C:\temp>del *.* /q
Invalid switch - /Q

0
 
LVL 7

Expert Comment

by:cmcgee
ID: 1715631
Sorry, my fault

Forgot that I was on my NT box....Duh......
0
 
LVL 2

Author Comment

by:kinkajou
ID: 1715632
Ah, the prowess of NT...
0
 
LVL 9

Expert Comment

by:rmarotta
ID: 1715633
If deleting everything, use DELTREE/Y.
The "Y" switch confirms all file deletions without prompting.
I hope it helps.
Ralph

0
 
LVL 2

Author Comment

by:kinkajou
ID: 1715634
Thanks Ralph, but it is not convienent to remove the directory that contains the files.
0
 
LVL 9

Expert Comment

by:rmarotta
ID: 1715635
I think you'll find that the only switch option for the DEL or ERASE command is "/P". (Which prompts user for confirmation before execution)
A directory that's been erased with DELTREE can be quietly re-created simply enough.
Ralph


0
 
LVL 2

Author Comment

by:kinkajou
ID: 1715636
Ralph,

Yes, I agree. I was hoping there might be somthing undocumented? How disappointing that these DOS tools are so limiting. Why don't you post an answer to get the points.
0
 
LVL 4

Accepted Solution

by:
Mark Aerts earned 80 total points
ID: 1715637
first, make a file called yes.txt with just a y (the letter "y")
then: DEL . < YES.TXT
and......
all gone

Mark
0
 
LVL 2

Author Comment

by:kinkajou
ID: 1715638
Ah ha, very nice. And to think that I gave in too soon...
Thanks Mark and your profile is so informative.
:)
0
 
LVL 9

Expert Comment

by:rmarotta
ID: 1715639
The only thing missing is to add  >nul  to keep it quiet.
Ralph

0
 
LVL 2

Author Comment

by:kinkajou
ID: 1715640
Thank you very much Ralph.
0
 
LVL 9

Expert Comment

by:rmarotta
ID: 1715641
I'm sure there are other, more elegant ways to accomplish what you want.
If this gets you going though, then the KISS principle applies.  :)
Regards to all,
Ralph

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
Compliance and data security require steps be taken to prevent unauthorized users from copying data.  Here's one method to prevent data theft via USB drives (and writable optical media).
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question