Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Need help making a deleting .bat file

15 Mar 2013   #1

Windows 7 Ultimate 32 bit OEM
Need help making a deleting .bat file

So basically i want a file i can click that deletes a whole folder
At the moment i have this program
HTML Code:
@ Echo Off
del c:/Users/Lewis/Desktop
And that will delete my desktop.
But the problem i have with this is when i click it i have to type Y or N to delete the files.
As I'm going to use this as my shutdown command as-well i don't want to have to type Y or N so is there any way to bypass this?

+ Just released i spelt the title wrong! Sorry

My System SpecsSystem Spec
15 Mar 2013   #2

Windows 7 Ultimate 32-Bit & Windows 7 Ultimate 64-Bit

Try using " /y " without the quotes at the end . That will choose yes you want to delete that file or folder
My System SpecsSystem Spec
15 Mar 2013   #3

Windows 7 Ultimate 32 bit OEM

Nope sorry it didnt work. Now i have just incounterd a new problem. The .bat file wont delete the desktop now?
My System SpecsSystem Spec

15 Mar 2013   #4
PooMan UK

Windows 7 Ultimate 64bit

del c:\users\lewis\desktop /s /q that should work fine, this will delete all the files in the desktop folder but it will leave the desktop folder and it won't prompt you for confirmation

If you want to remove the folder and all files within this folder then use

rmdir c:\users\lewis\desktop /s /q
My System SpecsSystem Spec
15 Mar 2013   #5

64-bit Windows 10 Pro

Hello Lewis,

If you wanted to delete all files in your Desktop folder instead of the folder, then you could use this below if you like. This way it will also work on any user account you run it in.

@echo off
DEL /F /S /Q /A "%UserProfile%\Desktop\*"
My System SpecsSystem Spec

 Need help making a deleting .bat file

Thread Tools

Similar help and support threads
Thread Forum
Deleting unwanted name from File name.
Computer repair engineer reinstalled windows7 premium back on to my computer but changed the ? name on the folder files i.e. C:\users\ Fixed4U\ documents\ or whatever. Can anyone tell me how to get rid of "Fixed4U" and replace it with my own name etc. Regards.
General Discussion
Need help deleting a non-existent file
I've got two files on my hard drive that I cannot get rid of. I deleted them at some point, but they left behind this "ghost" file that can't be deleted because the item cannot be found. When I go to properties, it says that the file type is "File (.)" and it opens with "Windows Shell Common Dll"....
General Discussion
Something (possibly MSE) keeps deleting my file
I want to download a very specific file (doesn't really matter what it is) and it keeps getting deleted off my computer as soon as I download it. And Microsoft Security Essentials automatically starts asking me to send them information about this file, which I am not keen to do. I am sure this...
System Security
Deleting old windows file
Wasn't sure which category this goes under but. Im running windows 7 ultimate atm, i installed it on a vista machine, on the second hard drive. Now im trying to delete the "windows" vista files on my main harddrive but it wont let me. Iv tried taking ownership but i keep getting the message ...
Installation & Setup
Making a DVD out of a .vob File
So...I have a .wma Movie File and a Converted .vob Movie File. I want to put the vob File on a DVD that can be played on DVD Players. I did it before using Xilisoft DVD Creator, but that was TrialWare and has watermarks. I recently downloaded BurnAware, but has Audio_TS and Video_TS Folders. I...
Music, Pictures & Video
No solution for deleting file in Win 7???
Hi there, I got the "Could not find this item" issues as posted earlier in this forum. However, all the solutions do not seem to work for me (Win 7 X64 with 4 Gb ram, on which I logon as Administrator!!!)..... * First tried F5 * Tried reboot * Tried command prompt and rd, attrib,...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 13:26.
Twitter Facebook Google+ Seven Forums iOS App Seven Forums Android App