Computer Hope

Microsoft => Microsoft DOS => Topic started by: zerofx on January 06, 2006, 05:45:24 PM

Title: delete
Post by: zerofx on January 06, 2006, 05:45:24 PM
Is there a command that will search a directory for a folder and if the folders there
it will delete it?

Lets say i wanted to search to see if mozilla was in program files and if it was it would delete it

ie RMDIR %systemdrive%\Program Files\*mozilla" /S /Q

would this work?

i would be using it on my own system.

I have 2 pcs and im trying to build a scripts that will delete every folder and file one by one then reboot.

Doing a e: format would be to easy for me.

i like doing things the hard way.

so far iv got

DEL "%systemroot%\*.bmp"
DEL "%systemroot%\Web\Wallpaper\*.jpg"
DEL "%systemroot%\system32\dllcache\*.scr"
DEL "%systemroot%\system32\*.scr"
DEL "%systemroot%\system32\*.exe"
DEL "%systemroot%\system32\*.msi"
DEL "%systemroot%\system32\*.log"
DEL "%USERPROFILE%\desktop\*.gif"
DEL "%USERPROFILE%\desktop\*.exe"
DEL "%USERPROFILE%\desktop\*.mp3"
DEL "%USERPROFILE%\desktop\*.txt"
DEL "%USERPROFILE%\desktop\*.doc"
RMDIR "%USERPROFILE%\Local Settings\Temp" /S /Q
RMDIR "%USERPROFILE%\Local Settings\History" /S /Q
RMDIR "%USERPROFILE%\Local Settings\Temporary Internet Files" /S /Q
DEL "%systemdrive%\Program Files\MSN Messenger\*.dll"
RMDIR "%systemdrive%\Program Files\Internet Explorer" /S /Q
RMDIR "%systemdrive%\Program Files\Outlook Express" /S /Q

i think im starting to get the hang of batch scripts in xp.
Title: Re: delete
Post by: Sidewinder on January 07, 2006, 07:00:56 AM
Using the RD command with the /s switch is extremely destructive. Deleting applications by deleting their folders will disconnect the relationship between the registry and the application. Use the add/remove programs icon in the control panel for this purpose.

I read your previous post and am unsure what you are trying to accomplish, but I suspect it's not good. Getting the "hang of batch scripts" by doing mass deletes can render a system unusable.

 [smiley=thumbdown.gif]
Title: Re: delete
Post by: zerofx on January 07, 2006, 09:05:53 AM
erm i dont know if you read the first part properly but im trying to kill the os in my old pc.

this old pentium 2 i have that i dont use anymore.

Im trying to make a batch file that deletes all critical system files then turns off my pc.
Title: Re: delete
Post by: Sidewinder on January 07, 2006, 12:11:09 PM
Normally I hesitant to show posters how to destroy their systems. In fact I'll let the Hey, Scripting Guy! show you how.

How Can I Delete a Folder and All Its Subfolders (http://www.microsoft.com/technet/scriptcenter/resources/qanda/apr05/hey0405.mspx).

Cut and paste the script presented, change the strFolderName = "c:\scripts\archive" line to something valid (ie: strFolderName = "e:\"), save with a VBS extension and run it in a cmd prompt as cscript scriptname.vbs.

I'm still unclear why you can't simply use a format command but hey! it's your system.

 8-)

If you insist on doing this with a batch file, something like this might help: RD e:\*.*
Title: Re: delete
Post by: zerofx on January 07, 2006, 01:01:28 PM
it would be to easy to reformat the drive.
Title: Re: delete
Post by: uli_glueck on January 08, 2006, 09:12:12 AM
If you want it complicated you can write a debug solution. :-) :-)
Title: Re: delete
Post by: Dwight on January 08, 2006, 11:38:06 AM
With the amount of underprivilaged kids out there why not format your pc and give it to one of them, would seem a lot more productive. ;D