Solved

DOS BATCH USING DEL needs to auto "yes"

Posted on 1998-06-23
15
3,123 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
SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

 
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 20 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

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!

Question has a verified solution.

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

When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
I was prompted to write this article after the recent World-Wide Ransomware outbreak. For years now, System Administrators around the world have used the excuse of "Waiting a Bit" before applying Security Patch Updates. This type of reasoning to me …
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

738 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