Solved

DOS BATCH USING DEL needs to auto "yes"

Posted on 1998-06-23
15
3,070 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
ScreenConnect 6.0 Free Trial

Check out the updates in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI that improves session organization and overall user experience. See the enhancements for yourself!

 
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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

Suggested Solutions

Recently Microsoft released a brand new function called CONCAT. It's supposed to replace its predecessor CONCATENATE. But how does it work? And what's new? In this article, we take a closer look at all of this - we even included an exercise file for…
This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

831 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