Solved

DOS BATCH USING DEL needs to auto "yes"

Posted on 1998-06-23
15
3,087 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
Easy, flexible multimedia distribution & control

Coming soon!  Ideal for large-scale A/V applications, ATEN's VM3200 Modular Matrix Switch is an all-in-one solution that simplifies video wall integration. Easily customize display layouts to see what you want, how you want it in 4k.

 
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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

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…
In this article, I will show you HOW TO: Perform a Physical to Virtual (P2V) Conversion the easy way from a computer backup (image).
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

828 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