Solved

DOS BATCH USING DEL needs to auto "yes"

Posted on 1998-06-23
15
3,037 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
  • 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
 
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
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
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

Do email signature updates give you a headache?

Do you feel like all of your time is spent managing email signatures? Too busy to visit every user’s desk to make updates? Want high-quality HTML signatures on all devices, including on mobiles and Macs? Then, let Exclaimer solve all your email signature problems today!

Join & Write a Comment

This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
In this article, I will show you HOW TO: Install VMware Tools for Windows on a VMware Windows virtual machine on a VMware vSphere Hypervisor 6.5 (ESXi 6.5) Host Server, using the VMware Host Client. The virtual machine has Windows Server 2016 instal…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now